views:

78

answers:

1

I have 7 RadioButtons on a Form

3 of them belongs one group and 4 of them to other group

I want the RadioButtons to be mutually exclusive within the group.

This can be achieved by putting them in two GroupBoxes,

Is there any way we can achieve this without putting them in a container like groupbox

+1  A: 

Putting them on a Panel would be easiest, but if you really don't want a container control, you can use a method I've used. Create your own CustomRadioButton by inheriting from RadioButton and add a Group property (string, int, doesn't matter). When the CheckChanged event fires, if the button has just become checked, search the parent container's Controls collection for other CustomRadioButton controls with the same value for Group and uncheck them. I've used this before and it works well. Really though, just use a Panel.

Matthew Ferreira
Hmmmm... I have no issues putting in a panel but can I make panel Transparent????Ultimately enduser should not feel that radiobuttons are put in a container,He should feel that all buttons(of different group) are on the Form only
Gaddigesh
You can make the Panel transparent, or the same color as the form it is on.
Matthew Ferreira