CheckBox.VisualState

From Xojo Documentation

Property (As CheckBox.VisualStates Enumeration )
aCheckbox.VisualState = newCheckBox.VisualStates EnumerationValue
or
CheckBox.VisualStates EnumerationValue = aCheckbox.VisualState

New in 2019r2

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 CheckBox.VisualStates enumeration to set or read the value of State.

CheckBox States.png

Setting the value of State automatically updates the Value property. Changing the CheckBox.VisualState 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.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 VisualState in a Select Case statement.

Select Case CheckBox1.VisualState
Case CheckBox.VisualStates.Unchecked
// The CheckBox is unchecked

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

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

End Select