Compartir a través de


How to: Group Windows Forms RadioButton Controls to Function as a Set

Windows Forms RadioButton controls are designed to give users a choice among two or more settings, of which only one can be assigned to a procedure or object. For example, a group of RadioButton controls may display a choice of package carriers for an order, but only one of the carriers will be used. Therefore only one RadioButton at a time can be selected, even if it is a part of a functional group.

You group radio buttons by drawing them inside a container such as a Panel control, a GroupBox control, or a form. All radio buttons that are added directly to a form become one group. To add separate groups, you must place them inside panels or group boxes. For more information about panels or group boxes, see Panel Control Overview (Windows Forms) or GroupBox Control Overview (Windows Forms).

To group RadioButton controls as a set to function independently of other sets

  1. Drag a GroupBox or Panel control from the Windows Forms tab on the Toolbox onto the form.

  2. Draw RadioButton controls on the GroupBox or Panel control.

See Also

Reference

RadioButton Control Overview (Windows Forms)
Panel Control Overview (Windows Forms)
GroupBox Control Overview (Windows Forms)
CheckBox Control Overview (Windows Forms)
RadioButton

Other Resources

RadioButton Control (Windows Forms)