Udostępnij za pośrednictwem


CheckBox Control Overview (Windows Forms)

 

The Windows Forms CheckBox control indicates whether a particular condition is on or off. It is commonly used to present a Yes/No or True/False selection to the user. You can use check box controls in groups to display multiple choices from which the user can select one or more.

The check box control is similar to the radio button control in that each is used to indicate a selection that is made by the user. They differ in that only one radio button in a group can be selected at a time. With the check box control, however, any number of check boxes may be selected.

A check box may be connected to elements in a database using simple data binding. Multiple check boxes may be grouped using the GroupBox control. This is useful for visual appearance and also for user interface design, since grouped controls can be moved around together on the form designer. For more information, see Windows Forms Data Binding and GroupBox Control.

The CheckBox control has two important properties, Checked and CheckState. The Checked property returns either true or false. The CheckState property returns either Checked or Unchecked; or, if the ThreeState property is set to true, CheckState may also return Indeterminate. In the indeterminate state, the box is displayed with a dimmed appearance to indicate the option is unavailable.

See Also

CheckBox
How to: Set Options with Windows Forms CheckBox Controls
How to: Respond to Windows Forms CheckBox Clicks
CheckBox Control