correct & incorrect?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    correct & incorrect?

    I have a problem getting the correct to count +1 every time I get an answer right
    and the incorrect is the same.

    I have two lbl's named number1 and number2 which produces a Rnd# in each lbl.

    I have a txt box for the answer called useranswer.

    A button to check if the answer is right called btnanswer.

    I have just added two more lbl's for the correct named lblcorrect & the other is lblincorrect. How do I get this to count when the correct answer is correct and the incorrect well incorrect because right now I have a msgbox telling me if I have it correct but I want it to also show how many the code I have is like this:

    [CODE=vb]Private Sub btnanswer_Click ()

    Dim answer As Integer
    answer = Val(Number1) + Val(Number2)
    If Val(userAnswer) = answer Then
    MsgBox ("YOU ARE CORRECT!")

    End IF[/CODE]
    Last edited by Killer42; Nov 21 '07, 02:47 AM. Reason: Changed CODe tag to CODE=vb
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    This is not necessarily a good way to go about it, but should work.

    [CODE=vb]Private Sub btnanswer_Click ()

    Dim answer As Integer
    answer = Val(Number1) + Val(Number2)
    If Val(userAnswer) = answer Then
    lblcorrect = val(lblcorrect) + 1
    MsgBox ("YOU ARE CORRECT!")
    Else
    lblincorrect = val(lblincorrec t) + 1
    End If[/CODE]

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      Thank You I see what i for got to put. sometime you get in a hurry and forget the little thing in a code thanks killer42

      lee123

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by lee123
        Thank You I see what i for got to put. sometime you get in a hurry and forget the little thing in a code thanks killer42
        Glad we could help. :)

        Comment

        Working...