1. Taller No.2
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim a, b, c As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = a + b
TextBox3.Text = c
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
Dim a, b, c As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
If (a = b) Then
TextBox3.Text = "Son Iguales"
Else
If (a > b) Then
TextBox3.Text = a
Else
TextBox3.Text = b
End If
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
Dim a As Integer
Dim cad As String
GroupBox1.Text = "For"
cad = ""
For a = 1 To 10
cad = cad + Str(a) + vbNewLine
Next
TextBox4.Text = cad
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles
Button4.Click
Dim a As Integer
Dim cad As String
cad = ""
a = 0
GroupBox1.Text = "While endWhile"
While (a < 10)
a = a + 1
cad = cad + Str(a) + vbNewLine
End While
TextBox4.Text = cad
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles
Button5.Click
Dim a As Integer
2. Dim cad As String
cad = ""
a = 0
GroupBox1.Text = "do while-loop"
Do While (a < 10)
a = a + 1
cad = cad + Str(a) + vbNewLine
Loop
TextBox4.Text = cad
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles
Button6.Click
Dim a As Integer
Dim cad As String
cad = ""
a = 0
GroupBox1.Text = "Do util - loop"
Do Until (a = 10)
a = a + 1
cad = cad + Str(a) + vbNewLine
Loop
TextBox4.Text = cad
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles
Button7.Click
Dim a As Integer
Dim cad As String
cad = ""
a = 0
Do
a = a + 1
cad = cad + Str(a) + vbNewLine
Loop While (a < 10)
TextBox4.Text = cad
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles
Button9.Click
TextBox4.BackColor = Color.Red
End Sub
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs)
Handles RadioButton1.CheckedChanged
TextBox4.BackColor = Color.Red
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs)
Handles RadioButton2.CheckedChanged
TextBox4.BackColor = Color.Green
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles
CheckBox1.CheckedChanged
3. TextBox4.BackColor = Color.Red
End Sub
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles
CheckBox2.CheckedChanged
'TextBox4.BackColor = Color.Blue
REM If (TextBox4.BackColor = Color.Red) Then
MsgBox(TextBox4.BackColor = Color.Red)
REM End If
End Sub
End Class
Formulario