The standard checkbox control used by desktop apps.
- For web apps, see WebCheckBox.
Checkboxes can have three states:
|| The Caption text does not wrap.
The following code in the CheckBox's ValueChanged event handler checks the value of the CheckBox:
If CheckBox1.Value Then
TextField1.Value = "True"
TextField1.Value = "False"
Because Checkbox is a three-state control, you can use the VisualState property to get and set its value. The CheckBox.VisualStates Enumeration is designed to get and set the values.
The following code sets the VisualState property of a CheckBox to Indeterminate.
CheckBox1.VisualState = CheckBox.VisualStates.Indeterminate
Because VisualState is an Enumeration, you cannot use the corresponding Integer value for comparison. The following code shows how to use State in a Select Case statement:
Select Case CheckBox1.VisualState
// The CheckBox is unchecked
// The CheckBox is checked
// The CheckBox state is indeterminate
See the entries for VisualState and Value for additional examples of setting and getting CheckBox values. See also the CheckBox.VisualStates Enumeration.