CheckBoxAdv Events in Windows Forms CheckBox (CheckBoxAdv)

This section gives detailed explanation about the CheckStateChanged and CheckedChanged events in CheckBoxAdv control.

CheckBoxAdv Events Description
CheckStateChanged This event occurs when the CheckState property is changed.
CheckedChanged This event is raised when the Checked property is changed.

CheckStateChanged Event

This event is raised when the CheckState property of CheckBoxAdv is changed and the event handler receives an argument of type EventArgs containing data related to this event.

private void checkBoxAdv1_CheckStateChanged(object sender, EventArgs e)
{
    Console.WriteLine(" CheckStateChanged event is raised");
}
Private Sub checkBoxAdv1_CheckStateChanged(ByVal sender As Object, ByVal e As EventArgs)
Console.WriteLine(" CheckStateChanged event is raised")
End Sub

CheckedChanged Event

This event is raised when the Checked property is changed and this property changes automatically when the CheckState property is changed.

private void checkBoxAdv1_CheckedChanged(object sender, EventArgs e)
{
    if (!checkBoxAdv1.Checked)
        MessageBox.Show("Checkbox Unchecked");
    else
        MessageBox.Show("Checkbox checked");
}
Private Sub checkBoxAdv1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
If Not checkBoxAdv1.Checked Then
MessageBox.Show("Checkbox checked”)
Else
MessageBox.Show("Checkbox checked)
End If
End Sub