-
Aug 19th, 2012, 02:19 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] multible choice checkboxes beside a line what is the best componet control to use
i need to do alot of multible choice questions ,what componet control is best to use?
thanks
-
Aug 19th, 2012, 05:41 PM
#2
Re: multible choice checkboxes beside a line what is the best componet control to u
Ordinary Checkbox control should work - if you need "alot" you can use control array. Am I missing something here?
-
Aug 19th, 2012, 05:54 PM
#3
Re: multible choice checkboxes beside a line what is the best componet control to u
Radio Buttons would be better. Avoids multiple choice answers!!!!
-
Aug 19th, 2012, 06:08 PM
#4
Re: multible choice checkboxes beside a line what is the best componet control to u
Option buttons are used for single selection within a group; quite often multiple choice is needed.
-
Aug 19th, 2012, 07:11 PM
#5
Re: multible choice checkboxes beside a line what is the best componet control to u
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)
-
Aug 19th, 2012, 08:18 PM
#6
Re: multible choice checkboxes beside a line what is the best componet control to u
Originally Posted by Max187Boucher
you could also use option buttons in different frame...
Sure, but what's the point?
-
Aug 19th, 2012, 09:21 PM
#7
Re: multible choice checkboxes beside a line what is the best componet control to u
each frame would be a question and easier to place at design time
-
Aug 19th, 2012, 11:57 PM
#8
Re: multible choice checkboxes beside a line what is the best componet control to u
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.
-
Aug 20th, 2012, 01:04 AM
#9
Re: multible choice checkboxes beside a line what is the best componet control to u
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.
-
Aug 20th, 2012, 09:11 AM
#10
Thread Starter
Fanatic Member
Re: multible choice checkboxes beside a line what is the best componet control to u
thanks yall
as long as i have 4 checkboxes beside each line . thanks
-
Aug 20th, 2012, 07:12 PM
#11
Re: multible choice checkboxes beside a line what is the best componet control to u
Originally Posted by DataMiser
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.
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?
-
Aug 20th, 2012, 08:46 PM
#12
Re: [RESOLVED] multible choice checkboxes beside a line what is the best componet c
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
-
Aug 20th, 2012, 09:59 PM
#13
Thread Starter
Fanatic Member
Re: [RESOLVED] multible choice checkboxes beside a line what is the best componet c
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
-
Aug 20th, 2012, 10:54 PM
#14
Re: [RESOLVED] multible choice checkboxes beside a line what is the best componet c
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
Last edited by Max187Boucher; Aug 20th, 2012 at 11:19 PM.
-
Aug 21st, 2012, 12:08 AM
#15
Re: [RESOLVED] multible choice checkboxes beside a line what is the best componet c
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
Last edited by Doogle; Aug 21st, 2012 at 12:50 AM.
Reason: Simplified code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|