Getting the Radio Button Value in Windows Forms

Posted on Updated on

I came across a question in the MSDN forums about accessing the Radio Buttons in Windows Forms. After reading the question I realized that radio buttons in Windows Forms are little tricky compared to the HTML or ASPX ones.

We can group the radio buttons using GroupBox control or the Panel Control. Then the set of radio buttons works together. The following code snippet explains on how to access the clicked radio buttons and their value when a button is clicked.

Radio buttons have the Click event and CheckChanged event, which we can use to get the value, but programmatically this snippet explains how to access the radio buttons inside a GroupBox.