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.
Printable View
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.
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