Radio Button

Used to take the choice from the user. We have to implement two or more radio buttons. At run time, any one of the radio buttons can be selected.
Raidio Button
API: System.Windows.Forms.RadioButton
Naming Convension: rbxxxxxx
Properties of RadioButton
Property Description
Name Specifies the name of the control.
Text Specifies the displayable text of the control.
Checked Represents the current status of the check box, whether it is checked or un-checked.
BackColor, ForeColor, Font, Enabled, Visible, Cursor, Size, Location, TextAlign, Image, ImageAlign, TabIndex, ContextMenuStrip

Events of RadioButton
Event Description
CheckedChanged Executes when the user selects the radio button.
Click, DoubleClick, MouseMove, MouseEnter, MouseLeave, KeyPress, Enter, Leave

Methods of RadioButton
Method Description
Focus() Moves the focus to the control.

Demo on Radio Button

Raidio Button
Design
label1:
Text: Select Background Color:
Name: lblBackgroundColor

radioButton1:
Text: Beige
Name: rbBeige

radioButton2:
Text: Light Green
Name: rbLightGreen

radioButton3:
Text: Light Yellow
Name: rbLightYellow


private void rbBeige_CheckedChanged(object sender, EventArgs e)
{
this.BackColor = Color.Beige;
}
private void rbLightGreen_CheckedChanged(object sender, EventArgs e)
{
this.BackColor = Color.LightGreen;
}
private void rbLightYellow_CheckedChanged(object sender, EventArgs e)
{
this.BackColor = Color.LightYellow;
}
private void rbBisque_CheckedChanged(object sender, EventArgs e)
{
this.BackColor = Color.Bisque;
}