i need to do alot of multible choice questions ,what componet control is best to use?
thanks
Printable View
i need to do alot of multible choice questions ,what componet control is best to use?
thanks
Ordinary Checkbox control should work - if you need "alot" you can use control array. Am I missing something here?
Radio Buttons would be better. Avoids multiple choice answers!!!!
Option buttons are used for single selection within a group; quite often multiple choice is needed.
you could also use option buttons in different frame (with no borders if you want) so you can only select one at a time (yes i know you can limit the checkboxes to only have 1 selected at a time)
each frame would be a question and easier to place at design time
I would go with option buttons, typically you would only want to allow one choice per question and option buttons are ideal for this. If you need to be able to select more than one answer for eash question then checkboxes would be a better choice.
I think that an array of CheckBoxes would be easier to manage, no need for separate containers for each question and answers set. It's a fairly trivial matter to make CheckBoxes 'behave' like Option Buttons in terms of only allowing one of a given set to be checked.
thanks yall
as long as i have 4 checkboxes beside each line . thanks
Typically but not always - there are plenty of cases when one question may have multiple correct answers.
Example:
Q: Which properties correctly describe Label control?
a) Name
b) Caption
c) Recordset
d) UseMnemonic
c) DataField
How in the world can you only choose one answer? :confused:
Rhinobull thats why it is up to the OP to decide what he wants to do. He haa not said if it was a 1 answer question or not. It depends on what kind of questions he will be asking but very Rarely i have seen questions with 3 answers in them. Every tests for license or school or polls are normally 1 queations answer and all of them will be the same. and for someone that is asking which control to use i would think he is not an expert like you are. So dealing with arrays and checkbox limitation might be a good thing to learn but it makes it more complicated. As option buttons are a bit easir to deal with (for beginners) in my point of view yes checkbox might be better but option buttons are a better choice if only 1 answer can be right
i tryed both metheds i had to finly use the checkbox methed itll be a heck of a lot of typing and im sure theres a faster way
realy ,thanks
Code:
If Check1(0).Value = 1 Then
Check1(1).Enabled = False
Check1(2).Enabled = False
ElseIf Check1(1).Value = 1 Then
Check1(0).Enabled = False
Check1(2).Enabled = False
ElseIf Check1(2).Value = 1 Then
Check1(1).Enabled = False
Check1(0).Enabled = False
Else
Check1(0).Value = 0
Check1(1).Value = 0
Check1(2).Value = 0
Check1(0).Enabled = True
Check1(1).Enabled = True
Check1(2).Enabled = True
End If
If Check2(0).Value = 1 Then
Check2(1).Enabled = False
Check2(2).Enabled = False
ElseIf Check2(1).Value = 1 Then
Check2(0).Enabled = False
Check2(2).Enabled = False
ElseIf Check2(2).Value = 1 Then
Check2(1).Enabled = False
Check2(0).Enabled = False
Else
Check2(0).Value = 0
Check2(1).Value = 0
Check2(2).Value = 0
Check2(0).Enabled = True
Check2(1).Enabled = True
Check2(2).Enabled = True
End If
If Check3(0).Value = 1 Then
Check3(1).Enabled = False
ElseIf Check3(1).Value = 1 Then
Check3(0).Enabled = False
Else
Check3(0).Value = 0
Check3(1).Value = 0
Check3(0).Enabled = True
Check3(1).Enabled = True
End If
i would do something like this
Code:Dim i As Integer
Dim SelectedFound As Boolean
For i = 0 To 2
check1(i).Enabled = CBool(check1(i).Value)
If check1(i).Enabled = True Then SelectedFound = True
Next
If Not SelectedFound Then
For i = 0 To 2
check1(i).Enabled = True
Next
End If
I see that you've marked the thread as resolved, but do you really want to disable the other CheckBoxes ? If the user can only select one correct answer then I would emulate the OptionButton methodology (as far as possible) and set all others to zero when one has been selected
Code:Private Sub Check1_Click(Index As Integer)
Dim intI As Integer
Static boChange As Boolean
If boChange Then Exit Sub
boChange = True
For intI = 0 To Check1.ubound
If intI <> Index Then
Check1(intI).Value = 0
End If
Next
boChange = False
End Sub