![]() |
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 :) |
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"
|
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.
|
Do you know how to create a 'Hello World' program? Are you using MS Visual Studio?
|
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.
|
@ 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? |
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:
:
|
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. |
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 :
|
Hey there. Thanks for the example. Does this mean i need a command button to execute the calculation of the score?:
:
Thanks |
| All times are GMT -5. The time now is 2:48 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC