I've a C# Windows Form Application that contains multiple Panels , each panel contains group of Radio Buttons.Is There a simple way to get just the checked RadioButton by code instead of checking every Radio Button in each group whether it is checked or not ? please help. Thanks
Asked
Active
Viewed 291 times
1 Answers
0
Try this:
foreach(Control control in panel.Controls)
{
RadioButton radioButton = control as RadioButton;
if (radioButton != null && radioButton.Checked)
return radioButton;
}

openshac
- 4,966
- 5
- 46
- 77
-
Not sure exactly what you need but you could of course have a loop for every panel as well and put all the items in a List
– openshac Jun 07 '10 at 12:27 -
Thanks openshac but how could i make a List
? – CSharpBeginner Jun 07 '10 at 12:48