8.10 Creating Grouped Radio Buttons

 <  Day Day Up  >  

8.10 Creating Grouped Radio Buttons

You want to create several groups of radio buttons.


Technique

Because radio button groups are mutually exclusive, you need to separate each group using a control container. Some of the possible control containers include the GroupBox , Panel , and a Windows Form itself. Determine which container you want to use and perform a drag and drop operation from the toolbox onto your Windows Form. To create a group of radio buttons within the control container you just created, drag each individual radio button in the group and drop it on the control container that you just created.

Comments

Radio buttons are similar to check boxes in that a radio button can either be checked or unchecked. The differences lie in the relationship between other like controls. Check boxes are inclusive, meaning that the state of one check box does not directly affect the state of another check box unless you programmatically make it so. In other words, two check boxes can be checked at the same time. Radio buttons, on the other hand, are mutually exclusive. Given a group of radio buttons, only one of them can be checked at one time. When a user clicks on a single radio button from a group of radio buttons, the state of that radio button changes to checked and any other radio buttons are set to unchecked.

To create separate groups of radio buttons, you have to place each group within different control containers. Control containers act to logically group controls to delineate them from any other controls on a form. GroupBox controls have been used since the beginning of Windows and are still valuable to this day. A GroupBox control uses a label and border around the controls it contains. A Panel control is a new control designed for the .NET Framework. By default, a Panel control is invisible during runtime and is simply a control container. You can, however, change a Panel control's properties such as its BackColor to give a visual indication to the user that a group of controls is related .

 <  Day Day Up  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net