> Hi folks!
Can anyone please help me with this?
I am developing a Quiz program but I am stuck with "multiple answers".
Basically I need some sort of code that would select multiple answers
using check boxes.
For example, a question such as
Which two of the following are relational databases?
A. Oracle
B. UML
C. ODBC
D. Ingres
It should track as A and D.
Can anyone please show a code that would track them two answers?
Also, how does the question bank (in the form of a database) looks
for; i.e. How do you store multiple answers in a database so VB tracks
those answers?
Thanks for your help
I don't know if it's the best way, but i would track the answers by
representing the whole thing as a single number. I would assign each letter
to a number, probably like this
A = 1
B = 10
C = 100
D = 1000
Then have some code that went through every check box, and added the value
of the each ticked check box to a sum.
Something like this
Answer = 0
if MyCheckA = True then
Answer = Answer + 1
end if
if MyCheckB = True then
Answer = Answer + 10
end if
if MyCheckC = True then
Answer = Answer + 100
end if
if MyCheckD = True then
Answer = Answer + 1000
end if
forgive my code it's late and i'm well beyond tired :(
So if they ticked the correct boxes, you should end up with an Answer of
1001 which you could check against the stored correct answer. It would get
more tricky if they get some points for ticking one of the correct boxes but
not the other one, and trickier still if they loose points for ticking the
wrong one(s). In that case it might be better to keep each answer as a
boolean value in it's own variable/field.
Steve