Example: Group Box Control
Example: Group Box Control
The GroupBox displays a frame around a group of controls with or without a caption. Use
a 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.
Windows Forms GroupBox controls are used to group other controls. There are three reasons
to group controls:
To create a visual grouping of related form elements for a clear user interface.
To create programmatic grouping (of radio buttons, for example).
For moving the controls as a unit at design time.
Example
In this example, let us add four check boxes in a group box. The check boxes will allow the
users to choose the source from which they came to know about the organization. If the user
chooses the check box with text "others", then the user is asked to specify and a text box is
provided to give input. When the user clicks the Submit button, he/she gets an appropriate
message.
The form in design view
CheckBox Control:
The CheckBox control allows the user to set true/false or yes/no type options. The user can
select or deselect it. When a check box is selected it has the value True, and when it is cleared,
it holds the value False.
Let's create two check boxes by dragging CheckBox controls from the Toolbox and dropping
on the form
The CheckBox control has three states, checked, unchecked and indeterminate. In the
indeterminate state, the check box is grayed out. To enable the indeterminate state,
the ThreeState property of the check box is set to be True.