469,587 Members | 2,700 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,587 developers. It's quick & easy.

correct & incorrect?

lee123
556 512MB
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
3 1508
Killer42
8,435 Expert 8TB
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
556 512MB
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
Killer42
8,435 Expert 8TB
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.

Similar topics

10 posts views Thread by Robert | last post: by
1 post views Thread by Bryan Olson | last post: by
1 post views Thread by Ken Linder (KC7RAD) | last post: by
14 posts views Thread by Arne | last post: by
10 posts views Thread by lovecreatesbeauty | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.