Results 1 to 8 of 8

Thread: Would someone please check my function? [SOLVED]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member hothead's Avatar
    Join Date
    Mar 2002
    Location
    Missouri
    Posts
    692

    Would someone please check my function? [SOLVED]

    VB Code:
    1. Public Function ComparePlayerAnswer()
    2.     Dim SelectedAnswer, Msg As String
    3.     Dim IsCorrect As Boolean
    4.     Dim NumTries As Integer
    5.     NumTries = NumTries + 1
    6.     If IsCorrect = True Then
    7.         IsCorrect = False
    8.     End If
    9.     For i = 0 To frmQuestions.cmdChoice.Count - 1
    10.         If frmQuestions.cmdChoice(i).Value = True Then
    11.             SelectedAnswer = frmQuestions.cmdChoice(i).Caption
    12.         End If
    13.     Next i
    14.     If SelectedAnswer = QuestionArray(CurrentQuestion).Answer Then
    15.         Msg = "You are Correct."
    16.         IsCorrect = True
    17.         If NumTries = 1 Then
    18.             Msg = Msg & "  5 picks on the game board have now been granted to you."
    19.         Else
    20.             Msg = Msg & "  1 pick on the game board has now been granted to you."
    21.         End If
    22.     Else
    23.         MsgBox "Incorrect"
    24.     End If
    25.     If IsCorrect = True Then
    26.         MsgBox Msg
    27.     End If
    28. 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.
    Last edited by hothead; Oct 5th, 2003 at 08:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width