CheckBox.State

From Xojo Documentation

aCheckbox.State = newCheckedStates EnumerationValue
or
CheckedStates EnumerationValue = aCheckbox.State

New in 2009r1

Supported for all project types and targets.

Gets or sets the state of the Checkbox.

Notes

A Checkbox can be in one of three states: Checked, Unchecked, or Indeterminate (see below). Use the CheckedStates Enumeration to set or read the value of State.

CheckBox States.png

Setting the value of State automatically updates the Value property. Changing the State to Checked or Indeterminate updates the Value property and sets it to True.

Sample Code

The following code sets the State property of a Checkbox to Indeterminate.

Checkbox1.State = Checkbox.CheckedStates.Indeterminate

Because State 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.State
Case CheckBox.CheckedStates.Unchecked
// The CheckBox is unchecked

Case CheckBox.CheckedStates.Checked
// The CheckBox is checked

Case CheckBox.CheckedStates.Indeterminate
// The CheckBox state is indeterminate

End Select