The CheckBox control displays a check mark when it is selected. It is commonly used to present a Yes/No or True/False selection to the user. You can use check box controls in groups to display multiple choices from which the user can select one or more.
The CheckBox control is similar to the OptionButton control in that each is used to indicate a selection that is made by the user. They differ in that only one option button in a group can be selected at a time. With the CheckBox control, however, any number of check boxes may be selected.
CheckBox
The CheckBox control has the following properties, methods, and events.
The Value property of the CheckBox control indicates whether the check box is checked, unchecked, or unavailable (dimmed). When selected, the value is set to 1. The following table lists the values that are used to set the Value property.
Setting | Value |
---|---|
Unchecked | 0 |
Checked | 1 |
Unavailable | 2 |
The user clicks the CheckBox control to indicate a checked or unchecked state. You can then test for the state of the control and program your application to perform some action based on this information.
By default, the CheckBox control is set to 0. If you want to preselect several check boxes in a series of check boxes, you can do so by setting the Value property to 1 in the Form_Load or Form_Initialize procedures.
You can also set the Value property to 2 to disable the check box. This is useful if you want to disable a check box until a certain condition is met.