tags:

views:

28

answers:

1

I have 4 checkboxes on a winform

I need to group them in such a way that

-> User should be able to check more than one checkboxes

-> User should not be allowed to uncheck all the checkboxes,

that is at any point of time atleast one checkbox should be checked,

(I need to somehow prevent user from unchecking last checkboxe)

How do I achieve this?

+1  A: 

Use the CheckedChanged event to check the state of the check boxes. Don't allow them to uncheck if there will be none checked.

Also you can have the checkbox controls pointed to the same event using something like below.

chkboxes1.CheckedChanged += new EventHandler(chkboxes_CheckedChanged); chkboxes2.CheckedChanged += new EventHandler(chkboxes_CheckedChanged); chkboxes3.CheckedChanged += new EventHandler(chkboxes_CheckedChanged);

buckbova