Skip to content

Instantly share code, notes, and snippets.

Created March 11, 2009 19:21
Show Gist options
  • Save anonymous/77661 to your computer and use it in GitHub Desktop.
Save anonymous/77661 to your computer and use it in GitHub Desktop.
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = "A" Then
Dim arr As String() = New String() {"A", "B", "C"}
Randomize()
TextBox2.Text = arr(Math.Floor((3) * Rnd()))
End If
If TextBox1.Text = "B" Then
Dim arr As String() = New String() {"A", "B", "C"}
Randomize()
TextBox2.Text = arr(Math.Floor((3) * Rnd()))
End If
If TextBox1.Text = "C" Then
Dim arr As String() = New String() {"A", "B", "C"}
Randomize()
TextBox2.Text = arr(Math.Floor((3) * Rnd()))
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nr As Integer
Randomize()
nr = CInt(Rnd() * 2) + 1
If nr = 1 Then
TextBox1.Text = "A"
End If
If nr = 2 Then
TextBox1.Text = "B"
End If
If nr = 3 Then
TextBox1.Text = "C"
End If
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
If TextBox1.Text = "A" And TextBox2.Text = "A" Then
TextBox3.Text = "A1"
End If
If TextBox1.Text = "A" And TextBox2.Text = "B" Then
TextBox3.Text = "A2"
End If
If TextBox1.Text = "A" And TextBox2.Text = "C" Then
TextBox3.Text = "A3"
End If
If TextBox1.Text = "B" And TextBox2.Text = "A" Then
TextBox3.Text = "B1"
End If
If TextBox1.Text = "B" And TextBox2.Text = "B" Then
TextBox3.Text = "B2"
End If
If TextBox1.Text = "B" And TextBox2.Text = "C" Then
TextBox3.Text = "B3"
End If
If TextBox1.Text = "C" And TextBox2.Text = "A" Then
TextBox3.Text = "C1"
End If
If TextBox1.Text = "C" And TextBox2.Text = "B" Then
TextBox3.Text = "C2"
End If
If TextBox1.Text = "C" And TextBox2.Text = "C" Then
TextBox3.Text = "C3"
End If
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment