Results 1 to 15 of 15

Thread: [RESOLVED] multible choice checkboxes beside a line what is the best componet control to use

  1. #1
    Fanatic Member
    Join Date
    Feb 09
    Posts
    561

    Resolved [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

  2. #2

  3. #3
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,544

    Re: multible choice checkboxes beside a line what is the best componet control to u

    Radio Buttons would be better. Avoids multiple choice answers!!!!

  4. #4

  5. #5
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    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)

  6. #6

  7. #7
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    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

  8. #8
    PowerPoster
    Join Date
    Feb 12
    Location
    West Virginia
    Posts
    4,957

    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.

  9. #9
    PowerPoster
    Join Date
    Jul 06
    Location
    Maldon, Essex. UK
    Posts
    5,150

    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.

  10. #10
    Fanatic Member
    Join Date
    Feb 09
    Posts
    561

    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

  11. #11
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 04
    Location
    New Amsterdam
    Posts
    23,594

    Re: multible choice checkboxes beside a line what is the best componet control to u

    Quote Originally Posted by DataMiser View Post
    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?

  12. #12
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    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

  13. #13
    Fanatic Member
    Join Date
    Feb 09
    Posts
    561

    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

  14. #14
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    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.

  15. #15
    PowerPoster
    Join Date
    Jul 06
    Location
    Maldon, Essex. UK
    Posts
    5,150

    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
  •