RadioButton Control.
The RadioButton control allows you to choose one item within the parent control
or group of items. When a user selects one option within a group of options the
other options clear automatically. Typically the options are on the line of Yes/No,
Male/Female, True/False etc. The RadioButton is very similiar to the CheckBox control.
The main difference is with the CheckBox control, the user can select multiple choices
within the same group of options.

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