Groups | Blog | Home
all groups > dotnet compact framework > october 2004 >

dotnet compact framework : Windows Form Group Box


Nadia
10/7/2004 2:43:02 PM
if you put three Radio Buttons in a group box. Is there a way to use the
group box control to check an see which radio button is selected. Instead of
having to check each radio button to see if it is selected?

C# Please.

Darren Shaffer
10/7/2004 8:53:33 PM
there is no group box control in the .Net Compact Framework, however
if you place multiple radio buttons on a form or panel, their boolean state
behaves as a group but you do need to interrogate each one to determine
which (if any) is checked.

-Darren

[quoted text, click to view]

Nadia
10/8/2004 6:03:03 AM
well if you don't interrogate each one, then how can you find out which one
is checked?

Code Example please.

[quoted text, click to view]
Duncan Mole
10/8/2004 2:40:15 PM
you could write a genic method for this such as below (not tested)

public RadioButton GetSelected(Control owner)
{
foreach(Control control in owner.Controls)
{
if(control is RadioButton)
{
RadioButton candidate = (RadioButton)candidate;
if(candidate.Checked)
return candidate;
}
}
return null;
}

[quoted text, click to view]

AddThis Social Bookmark Button