Results 1 to 2 of 2

Thread: question on Check boxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    19
    E.g i type a question and put in 4 check boxes and a button.
    How do i write the commandline in such a way that on when one of the check boxes is click on and the button is click on, the result will be made known to the user.

    Thank you for your help.
    God bless
    Nigel
    [email protected]

  2. #2
    Guest

    Thumbs up Hmmm.....ok this is like a question with mutli answers yeah

    Ok the question is in a textbox, and you clever thing, you are using it to handle multi questions????

    Ok make sure the check Boxes are in an array, look at the index property to achieve this

    So we have something like

    txtQuestion.Text = "Who makes vb"

    And four check boxes with

    chkBox(0).Caption = "Netscape"
    chkBox(1).Caption = "Borland"
    chkBox(2).Caption = "General Automation"
    chkBox(3).Caption = "Microsoft"

    Ok add a label to the form and call it lblAnswer. Set the Caption to ""

    Double click on your command button to bring up the code window, and enter

    Public Sub cmdButton() ' ok vb already adds this
    '
    If chkBox(3).Value = vbChecked Then
    lblAnswer.Caption = "Correct"
    Else
    lblAnswer.Caption = "Incorrect. The Answer is Microsoft"
    End If
    '
    End Sub

    Now l persume the check boxes are mutually exlusive, if not provide more detailed instructions in your label

    Hope it helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width