Encapsulates a standard Windows® group box.
Object
MarshalByRefObject
MarshalByRefComponent
Control
RichControl
GroupBox
[Visual Basic] Public Class GroupBox Inherits RichControl [C#] public class GroupBox : RichControl [C++] public __gc class GroupBox : public RichControl [JScript] public class GroupBox extends RichControl
The GroupBox displays a frame around a group of controls with or without a caption. Use a GroupBox to visually identify a group of controls on a form. This is a container control that can be used to define groups of RadioButton controls.
To contain controls, you must first create the GroupBox and then draw controls on its surface. If you drag existing controls onto it, they have the appearance of being within the group but are not actually contained by the GroupBox.
Namespace: System.WinForms
Assembly: System.WinForms.dll
The following example instantiates a GroupBox on a form and adds two RadioButton controls to it.
[Visual Basic]
' Instantiate a GroupBox and two RadioButtons. Private GroupBox1 As System.WinForms.GroupBox Private RadioButton1 As System.WinForms.RadioButton Private RadioButton2 As System.WinForms.RadioButton Private Sub MySub() ' ' Initialize the GroupBox and RadioButtons. Form1.GroupBox1 = New System.WinForms.GroupBox Form1.RadioButton1 = New System.WinForms.RadioButton Form1.RadioButton2 = New System.WinForms.RadioButton ' Add the RadioButtons to the GroupBox. GroupBox1.Controls.Add(RadioButton1) GroupBox1.Controls.Add(RadioButton2) ' Add the GroupBox to the Form. Form1.Controls.Add(GroupBox1) End Sub
GroupBox Members | System.WinForms Namespace | RichControl | RadioButton