Windows Develop Bookmark and Share   
 index > Windows Forms General > How to get selected radiobutton in a radiogroup
 

How to get selected radiobutton in a radiogroup

Hello! I have the following xml code:

<GroupBox Header="Fruits" Padding="5" Margin="12">

<StackPanel>

<RadioButton Name="BananaRadio" GroupName ="FruitsRadioGroup"\>Banana</RadioButton>

<RadioButton Name="AppleRadio" GroupName ="FruitsRadioGroup"\>Apple</RadioButton>

<RadioButton Name="OrangeRadio" GroupName ="FruitsRadioGroup"\>Orange</RadioButton>

</StackPanel>

</GroupBox>

Question:

In my .cs file, how do I know which radiobutton is currently selected? Is there a way?

sybarite  Thursday, November 22, 2007 4:57 AM

Hi sybarite,

As far as I know, GroupBox/StackPanel doesn’t provide a method to get selected RadioButton in it. I think you should check the value of RadioButton.Checked for each RadioButton to determine which one is currently selected.

Yan-Fei Wei  Monday, November 26, 2007 2:36 AM

Hi sybarite,

As far as I know, GroupBox/StackPanel doesn’t provide a method to get selected RadioButton in it. I think you should check the value of RadioButton.Checked for each RadioButton to determine which one is currently selected.

Yan-Fei Wei  Monday, November 26, 2007 2:36 AM

You can use google to search for other answers

Custom Search

More Threads

• Form focus when it contains controls?
• How to SET FOCUS on multiple textBoxes?
• How can I capture the language bar and Microsoft Agent?
• Menu inheritance for forms
• An alternative to PictureBox
• WebBrowser Control and Printing
• ListView - Selecting an Item Programmatically
• excel not closing after reading
• Button Image in smart Device in C#
• [C#] Can't delete a file