0% found this document useful (0 votes)
16 views4 pages

Ejercicio 2: 'Calcula La Suma

The document contains code for 7 exercises that perform calculations and logical evaluations on user-input values. Exercise 2 contains code to calculate summation, subtraction, multiplication and division when respective buttons are clicked. Exercise 3 evaluates if a input value is null, even or odd. Exercise 6 converts a numeric month input to its name. Exercise 7 performs addition, subtraction, multiplication or division based on the checked radio button, and displays the result.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Ejercicio 2: 'Calcula La Suma

The document contains code for 7 exercises that perform calculations and logical evaluations on user-input values. Exercise 2 contains code to calculate summation, subtraction, multiplication and division when respective buttons are clicked. Exercise 3 evaluates if a input value is null, even or odd. Exercise 6 converts a numeric month input to its name. Exercise 7 performs addition, subtraction, multiplication or division based on the checked radio button, and displays the result.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EJERCICIO 2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
'CALCULA LA SUMA
Label4.Text = Val(TextBox1.Text) + Val(TextBox3.Text)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
'CALCULA LA RESTA
Label4.Text = Val(TextBox1.Text) - Val(TextBox3.Text)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
'CALCULA LA MULTIPLICACION
Label4.Text = Val(TextBox1.Text) * Val(TextBox3.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
'CALCULA LA DIVICION
Label4.Text = Val(TextBox1.Text) / Val(TextBox3.Text)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
'LIMPA LOS CONTROLES
TextBox1.Text = ""
TextBox3.Text = ""
Label4.Text = ""
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
End
End Sub

EJERCICIO 3
Dim A As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
A = Val(TextBox1.Text)
If A = 0 Then
Label2.Text = "NULO"
ElseIf A Mod 2 = 0 Then
Label2.Text = "ES PAR"
ElseIf A Mod 2 <> 0 Then
Label2.Text = "ES IMPAR"
End If

EJERCICIO 6
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Ames As String, mes As Integer
mes = Val(TextBox3.Text)
Select Case mes
Case 1 : Ames = "Enero"
Case 2 : Ames = "Febrero"
Case 3 : Ames = "Marzo"
Case 4 : Ames = "Abril"
Case 5 : Ames = "Mayo"
Case 6 : Ames = "Junio"
Case 7 : Ames = "Julio"
Case 8 : Ames = "Agosto"

Case 9 : Ames = "Septiembre"


Case 10 : Ames = "Octubre"
Case 11 : Ames = "Noviembre"
Case 12 : Ames = "Diciembre"
End Select
Label5.Text = TextBox1.Text & " de " & Ames & " de " &
TextBox2.Text
End Sub
Private Sub limpiar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles limpiar.Click
'LIMPIA LOS CONTROLES
Label5.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub

EJERCICIO 7

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim a, b As Double
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
If RadioButton1.Checked Then
Label1.Text = a + b
ElseIf RadioButton2.Checked Then
Label1.Text = a - b
ElseIf RadioButton3.Checked Then
Label1.Text = a * b
ElseIf RadioButton4.Checked Then
Label1.Text = a / b
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub

You might also like