How to get CheckState of checkbox in

If the ThreeState property of the CheckBox control is set to false, then it shows only two state(checked and unchecked). you can get the selection state of the CheckBox control with the help of CheckState() property that has three enumerations:

Checked The CheckBox displays a check mark.
Unchecked The CheckBox is empty.
Indeterminate The CheckBox displays a check mark and is shaded.


Following example code displays the check state of the checkbox1 control in a label named label1.

Private Sub CheckBox1_CheckStateChanged(ByVal sender As System.Object, _
                                   ByVal e As System.EventArgs) _
                                   Handles CheckBox1.CheckStateChanged
    If (CheckBox1.CheckState = CheckState.Checked) Then
           Label1.Text = "Checkbox in 'checked' state"
    ElseIf (CheckBox1.CheckState = CheckState.Indeterminate) Then
           Label1.Text = "Checkbox in 'Indeterminate' state"
    ElseIf (CheckBox1.CheckState = CheckState.Unchecked) Then
           Label1.Text = "Checkbox in 'Unchecked' state"
    End If
End Sub