By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,076 Members | 2,098 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,076 IT Pros & Developers. It's quick & easy.

correct & incorrect?

lee123
100+
P: 556
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnanswer_Click()
  2.  
  3.     Dim answer As Integer
  4.     answer = Val(Number1) + Val(Number2)
  5.     If Val(userAnswer) = answer Then
  6.     MsgBox ("YOU ARE CORRECT!")
  7.  
  8. End IF
Nov 21 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 5K+
P: 8,434
This is not necessarily a good way to go about it, but should work.

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnanswer_Click()
  2.  
  3.     Dim answer As Integer
  4.     answer = Val(Number1) + Val(Number2)
  5.     If Val(userAnswer) = answer Then
  6.         lblcorrect = val(lblcorrect) + 1
  7.         MsgBox ("YOU ARE CORRECT!")
  8.     Else
  9.         lblincorrect = val(lblincorrect) + 1
  10.     End If
Nov 21 '07 #2

lee123
100+
P: 556
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
Nov 21 '07 #3

Expert 5K+
P: 8,434
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. :)
Nov 22 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.