Hi everyone,
I am making a quiz program in Visual Basic 6.0, where the question is answered in a text box, and, if correct, a certain number of marks is added to the displayed score as you go. However, i am confused about what coding for this needs to be done, and what the scored is displayed in (a label perhaps?). So, I ask, could someone give me so example code so i get the idea how to approach this? I know its a amatuer question, but I am having trouble getting my head around what coding to use in certain situations ('if' statements, calculations, etc). Also, could someone give me a good site to learn about this stuff? Also, hints, tips are appreciated.
Many Thanks in advance, I appreciate your help
Completely new, please help
Started by verion24, Jul 19 2007 10:19 PM
11 replies to this topic
#1
Posted 19 July 2007 - 10:19 PM
|
|
|
#2
Guest_Jordan_*
Posted 20 July 2007 - 02:39 PM
Guest_Jordan_*
A label would be the easiest to display in. I'm not sure of the entire program so I really can't help you much. Maybe more details?
#3
Posted 20 July 2007 - 07:25 PM
Hi there thanks for your help.
All questions are on the one form, and are shown in labels. When a user enters the correct answer in the textbox, below the label, I would like the score displaying label to add a certain number of marks, depending on the difficulty of the question. The score doesn't need to be added up at the end, just as-you-go. There will only be one correct answer in each question. The only objects that i assume require coding are the textbox, and the scoring label (and of course the 'exit' button, and one to return to the main menu, but I worked that out). If you could help, that would be great.
All questions are on the one form, and are shown in labels. When a user enters the correct answer in the textbox, below the label, I would like the score displaying label to add a certain number of marks, depending on the difficulty of the question. The score doesn't need to be added up at the end, just as-you-go. There will only be one correct answer in each question. The only objects that i assume require coding are the textbox, and the scoring label (and of course the 'exit' button, and one to return to the main menu, but I worked that out). If you could help, that would be great.
#4
Guest_Jordan_*
Posted 20 July 2007 - 07:48 PM
Guest_Jordan_*
What part of the program do you need help with? It may be best if you post the code that you have so far.
#5
Posted 20 July 2007 - 08:10 PM
Hi there. I found out from another source that an 'if' statement is required. This is what i have done so far for the first question:
The code does not work. The answer is beijing, and i am attempting to make the label add 1 mark if the answer is correct. Is the third line what you call a calulcation?
Thanks
Private Sub txtquestion1_Change(Index As Integer) If txtquestion1.Text = Beijing Then lblscore.Caption = Format(txtquestion1.Text + 1) End If End Sub
The code does not work. The answer is beijing, and i am attempting to make the label add 1 mark if the answer is correct. Is the third line what you call a calulcation?
Thanks
#6
Posted 06 September 2007 - 09:58 AM
You need an "If" statement only to check if the answer is correct. Example:
Dim strAnswer as String
Dim intScore as Integer
strAnswer = Text1.Text
If strAnswer = "Beijing" then
intScore = intScore + 5 'marks given for particular question
Label1.Caption = "Current score is: " & intScore
End If
Dim strAnswer as String
Dim intScore as Integer
strAnswer = Text1.Text
If strAnswer = "Beijing" then
intScore = intScore + 5 'marks given for particular question
Label1.Caption = "Current score is: " & intScore
End If
#7
Posted 06 September 2007 - 10:07 AM
o0TheNerd0o said:
You need an "If" statement only to check if the answer is correct. Example:
Dim strAnswer as String
Dim intScore as Integer
strAnswer = Text1.Text
If strAnswer = "Beijing" then
intScore = intScore + 5 'marks given for particular question
Label1.Caption = "Current score is: " & intScore
End If
Dim strAnswer as String
Dim intScore as Integer
strAnswer = Text1.Text
If strAnswer = "Beijing" then
intScore = intScore + 5 'marks given for particular question
Label1.Caption = "Current score is: " & intScore
End If
This one should work just fine. But I think that if you enter beijing instead of Beijing then it would be marked as wrong.
#8
Posted 06 September 2007 - 10:21 AM
then convert to all lower case using the LCase() function.
If LCase(strAnswer) = "beijing" Then
It will convert the entire string into lower case characters. You can also use th UCase() function which does the opposite. And another sugggestion, why not make the quiz multiple choice? That would solve your upper/lower case problem too.
If LCase(strAnswer) = "beijing" Then
It will convert the entire string into lower case characters. You can also use th UCase() function which does the opposite. And another sugggestion, why not make the quiz multiple choice? That would solve your upper/lower case problem too.
Option Explicit
:cool:
:cool:
#9
Posted 08 September 2007 - 02:45 AM
And will even make easier the coding and the user to answer the quiz.
#10
Posted 08 September 2007 - 10:31 AM
When building end-user applications... The less they have to do or worry about, the better. If they're concerned with upper or lower case, it becomes a headache for the user. Simple things like this will make your applications more user friendly.
Option Explicit
:cool:
:cool:
#11
Posted 09 September 2007 - 02:05 AM
The trick in having an application a success or failure is all in the GUI and user-friendliness. Take Windows as an example!
#12
Posted 17 September 2007 - 03:31 PM


Sign In
Create Account

Back to top









