-
I hope someone can help. I need to create a Sample Test. This test has 10 questions, 3 option buttons (answers), a command button (NEXT) to go to next question and finally a Summary Page. I have 10 forms with the questions and 3 opt buttons on them also with the command button (NEXT) on each one. I'm not sure how to go about selecting the answer and putting it in the proper place on the Summary Page. The Summary Page has these fields: Total Questions, Number Right, Number Wrong and Percentage Right.If at all possible I need something by noon on DEC 6.
Is it possible to use a single form and create a datafile to store my questions and answers? If so how?
-
dim an array of your total question, ex:dim answer(10) as boolean
Then each time you click next,verify if he has the good answer:
if yes:answer(0)=True
if no:answer(0)=False
In your summary form:
go thru your array, count the true,count the false and
divide your total of question(ubound(answer))by the number
of good answer times 100.(for your %)
Hope i gave enough for you to start!!
-
´cause of the urgence, you can do this:
First, a module variable with the actual question (1 to 10). This will allow you to move forward and back. Use a select case to assign the question to a label. Use an array of integers(1 to 10) to save the answer, save it in both butttons (<- and ->). Initialize it to the first option. When the user press <- or ->, the value of the proper option must change.
When the user finish the test, make a for to do the summary.
Any doubt, let me know.
-
hmm...some ideas
if you want to use the 10 forms...set up some public variables.
Public Answer(9) as string
or maybe you set the whole thing to one form using Arrays.
Dim Question(9) as string
Dim Answer(9) as string
Dim Correct as Integer
The set each question ...
Question(0) = "First question..."
Question(1) = "Second..."
Etc.
(dont forget to set the answers too)
Use the indexes to set your labels
Click the next button...adds 1 to counter
label1.caption = question(Counter)
Etc...
I don't want to write the whole thing since this is a school project!
:)
good luck hope this helps!
-
Use three public variables which update on the fly, then on the summary page, output the values into the various text boxes.
Calculate the percentage right on the fly. Check that variables two and three (right and wrong) add up to var one (total q's)
As each q is answered (NEXT is pressed) update the relevant variable.
Questions and answers can be stored as plain text in a file and you can retrieve the data into an array. The array values can then be output to your ten forms text boxes and option buttons. Look up Open #
If you have a database, it would be even easier. You could use GetRows to fill a Variant Array.
I can't explain any further, 'cos I have to go home. It is past noon already for soome of us, but you have left it a bit late.
Cheers,
P.