Private Sub Go_Click()
If Text1.Text = Num1 Then
Shape1.BackColor = vbGreen
ElseIf Text1.Text = Num2 Then
Shape1.BackColor = vbYellow
ElseIf Text1.Text = Num3 Then
Shape1.BackColor = vbYellow
ElseIf Text1.Text = Num4 Then
Shape1.BackColor = vbYellow
Else: Shape1.BackColor = vbRed
End If
If Text2.Text = Num2 Then
Shape2.BackColor = vbGreen
ElseIf Text2.Text = Num1 Then
Shape2.BackColor = vbYellow
ElseIf Text2.Text = Num3 Then
Shape2.BackColor = vbYellow
ElseIf Text2.Text = Num4 Then
Shape2.BackColor = vbYellow
Else: Shape2.BackColor = vbRed
End If
If Text3.Text = Num3 Then
Shape3.BackColor = vbGreen
ElseIf Text3.Text = Num1 Then
Shape3.BackColor = vbYellow
ElseIf Text3.Text = Num2 Then
Shape3.BackColor = vbYellow
ElseIf Text3.Text = Num4 Then
Shape3.BackColor = vbYellow
Else: Shape3.BackColor = vbRed
End If
If Text4.Text = Num4 Then
Shape4.BackColor = vbGreen
ElseIf Text4.Text = Num1 Then
Shape4.BackColor = vbYellow
ElseIf Text4.Text = Num2 Then
Shape4.BackColor = vbYellow
ElseIf Text4.Text = Num3 Then
Shape4.BackColor = vbYellow
Else: Shape4.BackColor = vbRed
End If
Label6.Caption = Text1.Text 'Display Previous Input
Label7.Caption = Text2.Text
Label8.Caption = Text3.Text
Label9.Caption = Text4.Text
TriesAttempted = TriesAttempted + 1
If (TriesAttempted = 10) And ((Text1.Text <> Num1) Or (Text2.Text <> Num2) Or (Text3.Text <> Num3) Or (Text4.Text <> Num4)) Then
MsgBox "I'm So Surprise That You Couldn't Break The Code Within 10 Tries", , ""
MsgBox "Well, Try Again. Better Luck Next Time! =)", vbExclamation, "Game Over"
End If
If (Text1.Text = Num1) And (Text2.Text = Num2) And (Text3.Text = Num3) And (Text4.Text = Num4) Then
MsgBox "Congratulations! You Won!", vbExclamation, "Game Over"
End If
If ((Text1.Text = Num1) And (Text2.Text = Num2) And (Text3.Text = Num3) And (Text4.Text = Num4)) Or (TriesAttempted = 10) Then
Go.Enabled = False
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Delete.Enabled = False
End If
Text1.Text = "" 'Clear Textboxes
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub