Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 20th, 2007, 1:57 AM   #1
verion24
Newbie
 
Join Date: Jul 2007
Posts: 6
Rep Power: 0 verion24 is on a distinguished road
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
verion24 is offline   Reply With Quote
Old Jul 20th, 2007, 2:21 AM   #2
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 171
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
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"
PhilBon is offline   Reply With Quote
Old Jul 20th, 2007, 3:51 AM   #3
verion24
Newbie
 
Join Date: Jul 2007
Posts: 6
Rep Power: 0 verion24 is on a distinguished road
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.
verion24 is offline   Reply With Quote
Old Jul 20th, 2007, 6:54 AM   #4
Duck
Programmer
 
Join Date: Jun 2006
Location: England London
Posts: 72
Rep Power: 3 Duck is on a distinguished road
Do you know how to create a 'Hello World' program? Are you using MS Visual Studio?
__________________
.
Duck is offline   Reply With Quote
Old Jul 20th, 2007, 9:32 AM   #5
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,623
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
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.
big_k105 is offline   Reply With Quote
Old Jul 20th, 2007, 11:59 PM   #6
verion24
Newbie
 
Join Date: Jul 2007
Posts: 6
Rep Power: 0 verion24 is on a distinguished road
@ 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?
verion24 is offline   Reply With Quote
Old Jul 21st, 2007, 12:47 AM   #7
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 171
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
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)
  1. lblscore.Caption = Format(txtquestion1.Text + 1)
. Is lblscore a Label? If so you might want to check if it should be Text or Caption, In Vb.Net it's Text.
PhilBon is offline   Reply With Quote
Old Jul 21st, 2007, 1:56 AM   #8
verion24
Newbie
 
Join Date: Jul 2007
Posts: 6
Rep Power: 0 verion24 is on a distinguished road
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.
verion24 is offline   Reply With Quote
Old Jul 21st, 2007, 2:41 AM   #9
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 572
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
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)
  1. Dim Score As Integer
  2.  
  3. Private Sub Command1_Click()
  4. If Text1.Text = "Test" Then
  5. Score = Score + 1
  6. Label1.Caption = Score
  7. End If
  8. End Sub
  9.  
  10. Private Sub Form_Load()
  11. Label1.Caption = Score
  12. End Sub
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Jul 21st, 2007, 6:43 AM   #10
verion24
Newbie
 
Join Date: Jul 2007
Posts: 6
Rep Power: 0 verion24 is on a distinguished road
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)
  1.  
  2. Private Sub Command1_Click()

Thanks
verion24 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC