C# RadioButton Control

A radio button, also known as an option button, provides users with the ability to select a single option from a group of choices when used in conjunction with other radio buttons. By clicking on a radio button, it becomes checked, signifying the user's selection, while all other radio buttons within the same group automatically become unchecked. The RadioButton control offers the flexibility to display text, an image, or a combination of both.

radioButton1.Checked = true;

To interact with a RadioButton control, you can utilize the Checked property, which allows you to retrieve or modify the state of the radio button. When the Checked property is set to true, it indicates that the radio button is selected, while a value of false indicates that it is not selected.

C# radiobutton

It is important to note that radio buttons and check boxes serve different purposes. Radio buttons are ideal when you want users to choose only one option from a group, while check boxes are suitable for situations where users can select multiple options. Similar to check boxes, radio buttons also feature a Checked property, which indicates whether the radio button is currently selected.

Full Source C#
using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { radioButton1.Checked = true; } private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked == true) { MessageBox.Show ("You are selected Red !! "); return; } else if (radioButton2.Checked == true) { MessageBox.Show("You are selected Blue !! "); return; } else { MessageBox.Show("You are selected Green !! "); return; } } } }

Conclusion

To this end, the radio buttons should be leveraged to enhance user experience by allowing only one choice of radio buttons from multiple options that are clearly distinguished to the user at a time. This helps eliminate adequate uncertainty and undesired outcomes, thus enabling an easier and uniform option for the user to make a suitable selection.