First, load up the START button's click event handler. Then, use System.Random.
First, you create a new random object:
Code:
Dim r As New System.Random(Now.Millisecond)
Then, to choose a random number between 1 and 4:
Code:
Dim i As Integer = r.Next(1,5)
Note we use '5' and not '4'. This is because the upper bound is exclusive, so it means "everything
below the upper number. This does not apply to the lower number.
Then, use a select case statement:
Code:
Select Case i
Case 1
Box1.BackColor = Color.Red
End Case
Case 2
Box1.BackColor = Color.Blue
End Case
Case 3
Box1.BackColor = Color.Yellow
End Case
Case 4
Box1.BackColor = Color.Green
End Case
End Select
I
think that's how you do it in VB. I'm more used to C#, so it might not be exactly how you do Select Case statements.