System.Windows.Forms.GroupBox Class

Represents a Windows control that displays a frame around a group of controls with an optional caption.

See Also: GroupBox Members

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.ComponentModel.Designer("System.Windows.Forms.Design.GroupBoxDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultEvent("Enter")]
[System.ComponentModel.DefaultProperty("Text")]
public class GroupBox : Control

Remarks

The System.Windows.Forms.GroupBox displays a frame around a group of controls with or without a caption. Use a System.Windows.Forms.GroupBox to logically group a collection of controls on a form. The group box is a container control that can be used to define groups of controls.

The typical use for a group box is to contain a logical group of System.Windows.Forms.RadioButton controls. If you have two group boxes, each of which contain several option buttons (also known as radio buttons), each group of buttons is mutually exclusive, setting one option value per group.

You can add controls to the System.Windows.Forms.GroupBox by using the System.Windows.Forms.Control.ControlCollection.Add(Control) method of the Control.Controls property.

Note:

Only controls that are contained within the System.Windows.Forms.GroupBox control can be selected or receive focus. The complete System.Windows.Forms.GroupBox itself cannot be selected or receive focus. For more information about how this control responds to the Control.Focus and Control.Select methods, see the following System.Windows.Forms.Control members: Control.CanFocus, Control.CanSelect, Control.Focused, Control.ContainsFocus, Control.Focus, Control.Select.

The System.Windows.Forms.GroupBox cannot display a scroll bar. If you need a control similar to a System.Windows.Forms.GroupBox that can contain a scroll bar, see the System.Windows.Forms.Panel control.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0