473,395 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1715
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

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

Similar topics

7
by: Alf P. Steinbach | last post by:
The fourth part of my attempted Correct C++ tutorial is now available, although for now only in Word format (use free Open Office if no Word), and also, it's not yet been reviewed at all -- ...
10
by: Robert | last post by:
Hello all, I am a C programmer learning C++. And I am confused with function Pass by Pointer * or Pass by Reference &. Function pass by pointer like: void func(int * x) And function pass by...
1
by: Bryan Olson | last post by:
Yesterday I embarrassed myself on sci.crypt with some incorrect C code and corresponding claims about the language. My source was Harbison and Steele (H&S), /C, A Reference Manual/ and I thought...
1
by: Ken Linder (KC7RAD) | last post by:
All, I am successfully trapping log-in errors in my application BUT, I want to know what KIND of login error it is. I specifically want to trap Incorrect Password errors to watch for possible...
2
by: TonyM | last post by:
Q: Is there a good way to overcome this apparent bug without modifying the mfc code? ___________________________________ Info: Although it is NOT a good idea, I seemed to have perhaps located a...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
10
by: lovecreatesbeauty | last post by:
Is parameter type conversion required for the 2nd argument on printf("%p", (void *)&i); ? But one would never call memcpy like: memcpy((void *)pi, (void *)pj, sizeof *pj); /*memcpy((void *)pi,...
6
by: priyajohal | last post by:
#include<fstream.h> #include<process.h> #include<stdlib.h> #include<conio.h> #include<string.h> #include<dos.h> #include<ctype.h> #include<stdio.h> void setup() void help();
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.