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; } } } }


By using radio buttons, you can enhance the user experience by presenting clear and distinct choices and ensuring that only one option can be selected at a time. This aids in preventing ambiguous or conflicting selections and provides a streamlined interface for users to make their preferred choice.