Would someone please check my function? [SOLVED]
VB Code:
Public Function ComparePlayerAnswer()
Dim SelectedAnswer, Msg As String
Dim IsCorrect As Boolean
Dim NumTries As Integer
NumTries = NumTries + 1
If IsCorrect = True Then
IsCorrect = False
End If
For i = 0 To frmQuestions.cmdChoice.Count - 1
If frmQuestions.cmdChoice(i).Value = True Then
SelectedAnswer = frmQuestions.cmdChoice(i).Caption
End If
Next i
If SelectedAnswer = QuestionArray(CurrentQuestion).Answer Then
Msg = "You are Correct."
IsCorrect = True
If NumTries = 1 Then
Msg = Msg & " 5 picks on the game board have now been granted to you."
Else
Msg = Msg & " 1 pick on the game board has now been granted to you."
End If
Else
MsgBox "Incorrect"
End If
If IsCorrect = True Then
MsgBox Msg
End If
End Function
For some reason, NumTries is resetting itself every time the program processes the function. As a result, it is displaying that it will give the player 5 picks on the game board when it should in fact only be giving 1.