Im using GroupBox Control on my Form Page(WinForms).
The GroupBox contain five controls(RadioButtons).
Any idea how can I get the names and the states of controls inside GroupBox Control?
You can use Enumerable.OfType
to find and cast your RadioButtons
in the GroupBox:
var radioButtons = groupBox1.Controls.OfType<RadioButton>();
foreach (RadioButton rb in radioButtons)
{
bool state = rb.Checked;
string name = rb.Name;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With