Welcome to Dream.In.Code
Become a VB Expert!

Join 137,234 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,640 people online right now. Registration is fast and FREE... Join Now!




Simple Quiz program

 
Reply to this topicStart new topic

Simple Quiz program, Urgent help needed.

chazza07
12 Jan, 2007 - 12:59 PM
Post #1

New D.I.C Head
*

Joined: 12 Jan, 2007
Posts: 12



Thanked: 1 times
My Contributions
Hi,

I've got an assignment from my tutor to create a simple quiz game with 6 questions. I'm really struggling with this, I like programing but I'm finding it hard. I have started on it, this is what I have so far (with the help of my friends)
I have the front page, and instructions page linked to the front page by a button, the 6 questions to display and 3 radio buttons as the answers. However I have no idea how to make it check if the answers are correct, or how to reset each question so the radio buttons are not checked.

I also have another form which I want to display after the last question is answered, on this form I want it to display the users score.

Can any body help me with this, even if it is just a little I'd be really grateful. I need to have it done or at least improved by Tuesday.
Thanks
Charlie
User is offlineProfile CardPM
+Quote Post

KeyWiz
RE: Simple Quiz Program
12 Jan, 2007 - 01:59 PM
Post #2

D.I.C Regular
Group Icon

Joined: 26 Oct, 2006
Posts: 428


Dream Kudos: 125
My Contributions
if you create the radio buttons as an array you could use a Select Case routine to check which one is checked.

create an array for your questions and answers.

Dim Question(6,2) as String

Question(0,0) = "Are you a Human?"
Question(0,1) = "1"

etc.

This post has been edited by KeyWiz: 12 Jan, 2007 - 01:59 PM
User is offlineProfile CardPM
+Quote Post

chazza07
RE: Simple Quiz Program
13 Jan, 2007 - 10:47 AM
Post #3

New D.I.C Head
*

Joined: 12 Jan, 2007
Posts: 12



Thanked: 1 times
My Contributions
[quote name='KeyWiz' date='12 Jan, 2007 - 02:59 PM' post='195658']
if you create the radio buttons as an array you could use a Select Case routine to check which one is checked.

create an array for your questions and answers.

Dim Question(6,2) as String

Question(0,0) = "Are you a Human?"
Question(0,1) = "1"



Hi, thanks for that.

Your gonna think I'm thick for asking this but, how do I create an array?

Would it help if I posted the code I have already scraped together.
Thanks again.

User is offlineProfile CardPM
+Quote Post

KeyWiz
RE: Simple Quiz Program
13 Jan, 2007 - 10:53 AM
Post #4

D.I.C Regular
Group Icon

Joined: 26 Oct, 2006
Posts: 428


Dream Kudos: 125
My Contributions
read this article http://www.dreamincode.net/forums/showtopic20197.htm

and download and look at this code

http://www.dreamincode.net/code/snippet643.htm

This post has been edited by KeyWiz: 13 Jan, 2007 - 10:55 AM
User is offlineProfile CardPM
+Quote Post

chazza07
RE: Simple Quiz Program
13 Jan, 2007 - 03:05 PM
Post #5

New D.I.C Head
*

Joined: 12 Jan, 2007
Posts: 12



Thanked: 1 times
My Contributions
Hi, me again

I've done an array (thanks for that info btw), however I'm puzzled by the select case bit now.

After this it should be finished, I just need to make it calculate the users score at the end by adding up each question, this is the bit I'm really struggling with. Will the select case do this for me?

Thanks

Any helped greatly received.


User is offlineProfile CardPM
+Quote Post

KeyWiz
RE: Simple Quiz Program
13 Jan, 2007 - 09:20 PM
Post #6

D.I.C Regular
Group Icon

Joined: 26 Oct, 2006
Posts: 428


Dream Kudos: 125
My Contributions
Select-Case was designed to do away with the need to compare one term to many options. For instance here is a series of If-Then statements:
CODE

If a = 1 Then b = a+1
If a = 2 Then b = a+9
If a = 3 Then b = a+5
If a = 4 Then b = a+7
If a = 5 or a = 6 or a = 7 Then b = a+3
If a = 8 or a = 9 Then b = a+5


Now, this is fine and works perfectly, but extend it and you can see that this would take a lot of processing time to execute.
So Select-Case was created to speed it up, here is the same code as above, but in Select-Case
CODE

Select Case a
    Case = 1
        b=a+1
    Case = 2
        b = a+9
    Case = 3
        b = a+5
    Case = 4
        b = a+7
    Case = 5, 6, 7
        b = a+3
     Case = 8, 9
        b = a+5
End Select


The BIG difference, besides cutting down on typing, is the Select Case will automatically jump past all non-matching cases and is much faster than the If-Then series.

User is offlineProfile CardPM
+Quote Post

chazza07
RE: Simple Quiz Program
19 Jan, 2007 - 12:14 PM
Post #7

New D.I.C Head
*

Joined: 12 Jan, 2007
Posts: 12



Thanked: 1 times
My Contributions
Thanks, I've done all the code now.

Thanks for all your help.


Do you know how I can create test data for my program, I have been asked to do this but I'm not sure how.
User is offlineProfile CardPM
+Quote Post

KeyWiz
RE: Simple Quiz Program
19 Jan, 2007 - 05:07 PM
Post #8

D.I.C Regular
Group Icon

Joined: 26 Oct, 2006
Posts: 428


Dream Kudos: 125
My Contributions
QUOTE(chazza07 @ 19 Jan, 2007 - 01:14 PM) *

Thanks, I've done all the code now.

Thanks for all your help.


Do you know how I can create test data for my program, I have been asked to do this but I'm not sure how.


you simply input the KIND of data called for, make it up.
User is offlineProfile CardPM
+Quote Post

law
RE: Simple Quiz Program
13 Feb, 2007 - 11:56 AM
Post #9

New D.I.C Head
*

Joined: 13 Feb, 2007
Posts: 1


My Contributions
Is there any chance you could show me your code, i have done my array and have started my select case but really stuck thanks laura
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 04:01PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month