![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2007
Posts: 6
Rep Power: 0
![]() |
Completely new, please help
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? Many Thanks in advance ![]() |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
This sounds like homework. but it's not the school year, at least not for me. The whole point of programming, is taking a problem, splitting it up into smaller problems, then solving those small problems and then putting all the solutions together to solve the big problem. Separate your problems. i.e. score, display of score, etc. Make sure to read the forum rules, there is a link on the right under "site navigation"
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jul 2007
Posts: 6
Rep Power: 0
![]() |
Hi there, thanks for your response. We have been doing programming at school, however this was not set work. I have done a couple of vb "how-to" sheets, and created a few programs this way. I want to create a couple of programs myself at home, to learn it, and have a deeper knowledge of it. I would like to create a quiz, since I think it would be fun and satisfying to test others on a program i've created. If your still not comfortable giving me an example, any hints would be useful.
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Jun 2006
Location: England London
Posts: 72
Rep Power: 3
![]() |
Do you know how to create a 'Hello World' program? Are you using MS Visual Studio?
__________________
. |
|
|
|
|
|
#5 |
|
PFO Founder
![]() ![]() |
Well for each question you would have an if statement checking to see if they selected the right answer and if they didn't then it would be wrong. For displaying the score, a label would work fine. More or less the program would just be a bunch of if statements checking to see if they selected the right answer and then part that figures out the score.
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Jul 2007
Posts: 6
Rep Power: 0
![]() |
@ Duck: I have heard of the 'hello world' expression before, don't know what it means. Yes, I have Microsoft Visual Studio 6.0.
@ bigk_105: Thanks for your help. Anyway, now having more of an idea, i gave it another shot, but I must have done something wrong. I have coded for question 1 textbox: [HTML] Private Sub txtquestion1_Change(Index As Integer) If txtquestion1.Text = Beijing Then lblscore.Caption = Format(txtquestion1.Text + 1) End If End Sub [/HTML] The answer is supposed to be beijing, but the first line is yellow, and nothing happens when i enter Beijing, and an error comes up. Also, is the third line what you call a calculation? |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
|
it sees Beijing as a variable, rather than a string. Whenever you want to evaluate a string you must put quotes around it. As well as it should change to a different color. When using VB or VB.Net use [*highlight=vb] Vb Code[/highlight] or [*highlight=vbnet] VB.Net Code[/highlight] without the *. Why are you doing:
vb Syntax (Toggle Plain Text)
|
|
|
|
|
|
#8 |
|
Newbie
Join Date: Jul 2007
Posts: 6
Rep Power: 0
![]() |
I have put quotation marks around Beijing now, thanks for that. lblscore.caption is a label, correct. Just so you know, i'm not using VB.net, just the normal version.
With the third line i'm attempting to make lblscore.caption display 1 mark higher than it is currently. I've just realised i've absentmindedly put "txtquestion1.text" in. What should I put instead? Once again, thanks, I know I'm a bit tedious to deal with since I'm so unfamiliar with vb at the moment. |
|
|
|
|
|
#9 |
|
Expert Programmer
|
well as far as scoring, it would probobly be a good idea for a label. Now to keep score, you would want to create a variable and everytime someone gets a question correct you add to the score.
Example vb Syntax (Toggle Plain Text)
__________________
|
|
|
|
|
|
#10 |
|
Newbie
Join Date: Jul 2007
Posts: 6
Rep Power: 0
![]() |
Hey there. Thanks for the example. Does this mean i need a command button to execute the calculation of the score?:
vb Syntax (Toggle Plain Text)
Thanks |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Completely oblivous | CodeJunkie | Assembly | 30 | Aug 20th, 2005 11:03 AM |
| Completely new to VB.NET | Jaymes | Visual Basic .NET | 4 | May 28th, 2005 7:04 PM |
| Completely lost, help needed | bliznags | C++ | 2 | Mar 19th, 2005 4:44 PM |