Option Explicit
Dim score As Integer
Private Sub Command1_Click()
Dim Values(3) As ColorConstants
Values(0) = vbRed
Values(1) = vbBlue
Values(2) = vbGreen
Dim RandomNumber As ColorConstants
RandomNumber = Values(Rnd * 2)
Label1.BackColor = RandomNumber
Randomize
End Sub
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Text1.Text = Label1.BackColor = Values(0) Then
score = score + 1
Label3.Caption = score
End If
If Text1.Text = Label1.BackColor = Values(1) Then
score = score + 1
Label3.Caption = score
If Text1.Text = Label1.BackColor = Values(2) Then
score = score + 1
Label3.Caption = score
End Sub
Private Sub Form_Load()
Label2.Caption = "the color is:"
Text1.Text = ""
Label4.Caption = "score:"
Label1.Caption = ""
Command2.Caption = "submit"
End Sub
help guys! im currently making a color guessing game program, for every correct asnwer gives you score. i already got how to randomize 3 colors, my main problem is that i dont know what is the correct code in order for the user to get score. every time you will run the program it gives me the error variable not defined. please help me!! please check my code above. THANKS!