Grouping Windows Forms Radiobuttons with different parent controls in C#

Posted by Jerry on Stack Overflow See other posts from Stack Overflow or by Jerry
Published on 2011-01-07T15:47:42Z Indexed on 2011/01/07 15:54 UTC
Read the original article Hit count: 321

Filed under:
|
|

Hi,

I've got a Windows Forms application in which I have a number of RadioButtons. These RadioButtons are placed within a FlowLayoutPanel which automatically arranges them for me. All RadioButtons that are directly added to the FlowLayoutPanel are grouped, meaning I can select only one of them. However, some of these RadioButtons are paired up with a TextBox so I can supply some argument there. But to have all this arranged properly, I add a Panel control to the FlowLayoutPanel so I can control the alignment of the RadioButton and TextBox relatively to each other myself.

These RadioButtons now have their own respective Panels as parent controls and thus are no longer included in the radio group with the other RadioButtons. I read that the the RadioButtons that are in the System.Web.UI namespace have a GroupName property, but unfortunately their System.Windows.Forms counterparts lack this property. Is there some other way I can group these radio buttons are am I going to have to handle onClick events myself?

Thanks, Jerry

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms