CheckBox Control.
The CheckBox control allows the user to choose or tick all that apply type questions
from a list of options. The RadioButton is similar, but where the RadioButton only
allows you to choose one item within the parent control as Yes/No, Male/Female,
True/False etc, the CheckBox cotrol allows the user to choose from a combination
of options.

Namespace: System.Windows.Forms
Assembly: Systems.Windows.Forms.dll
using System.Windows.Forms;
Calling: System.Windows.Forms.CheckBox
Creating a new System.Windows.Forms.CheckBox control.
CheckBox checkBox1 = new CheckBox();
Adding the CheckBox control to a Windows form.
this.Controls.Add(checkBox1);
To create a CheckedChanged event for the CheckBox.
checkBox1.CheckedChanged +=new EventHandler(checkBox1_CheckedChanged);
To respond to the CheckedChanged event.
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
MessageBox.Show("checked");
}
}
|