C# – How to use RadioButton control?

RadioButton controls are used to get the mutually exclusive options from the user. It has similar functionality with CheckBox control. CheckBox control is to get combination of options from the user, whereas this control allowed to select mutually exclusive options.

Properties

When set AutoCheck property to True, the state of the RadiButton control automatically changed when we click on it.

We can retrieve or set the state of the RadioButton control using it’s Checked property. When the radio button is selected, the value of the Checked property will set to True; otherwise, it sets with the value False.

Another important interesting behavior of radio button controls is, they automatically unchecked when any other radio button control in the group is selected to ensure the user can select only one option at a time from the group of radio button controls. When we placed these controls on the Form, the controls shares the same group; to group them separately, either we need to place the controls in a Panel or with in a GroupBox.

Events

Most commonly used event is CheckedChanged event. It will raise whenever a Checked property of the control is changed.

(Raju)

Add a Comment

Your email address will not be published.