In VB6 and before, you could set any checkbox to one of three states—now you need to set the checkbox's ThreeState property to True to indicate that you want it to support three states.
By default, checkboxes are two-state controls; you use the Checked property to get or set the value of a two-state checkbox. However, if you set the checkbox's ThreeState property to True, you make the checkbox into a three-state control.
You use the CheckState property to get or set the value of the three-state checkbox. The three states are:
Checked— A check appears in the checkbox.
Unchecked— No check appears in the checkbox.
Indeterminate— A check appears in the checkbox on a gray background.
If the ThreeState property is set to True, the Checked property will return True for either a checked or indeterminate state.
If you've set the checkbox's ThreeState property to True, you can set its CheckState property to CheckState.Indeterminate at design time or run time to set the checkbox to the indeterminate state:
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged TextBox1.Text = "You clicked checkbox 1" CheckBox1.CheckState = CheckState.Indeterminate End Sub