Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Checked Property

CheckBox.Checked Property

Gets or set a value indicating whether the CheckBox is in the checked state.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[BindableAttribute(true)]
[SettingsBindableAttribute(true)]
public bool Checked { get; set; }

Property Value

Type: System.Boolean
true if the CheckBox is in the checked state; otherwise, false. The default value is false.
NoteNote

If the ThreeState property is set to true, the Checked property will return true for either a Checked or Indeterminate CheckState.

When the value is true, the CheckBox portion of the control displays a check mark. If the Appearance property is set to Button, the control will appear sunken when Checked is true and raised like a standard button when false.

The following code example displays the values of three properties in a label. The ThreeState property alternates between true and false with alternating clicks of the control and the CheckAlign alternates between a ContentAlignment value of MiddleRight and MiddleLeft. This example shows how the property values change as the ThreeState property changes and the control is checked. This example requires that a CheckBox, Label and Button have all been instantiated on a form and that the label is large enough to display three lines of text, as well as a reference to the System.Drawing namespace. This code should be called in the Click event handler of the control.

private void AdjustMyCheckBoxProperties()
 {
    // Change the ThreeState and CheckAlign properties on every other click. 
    if (!checkBox1.ThreeState)
    {
       checkBox1.ThreeState = true;
       checkBox1.CheckAlign = ContentAlignment.MiddleRight;
    }
    else
    {
       checkBox1.ThreeState = false;
       checkBox1.CheckAlign = ContentAlignment.MiddleLeft;
    }

    // Concatenate the property values together on three lines.
    label1.Text = "ThreeState: " + checkBox1.ThreeState.ToString() + "\n" +
                  "Checked: " + checkBox1.Checked.ToString() + "\n" +
                  "CheckState: " + checkBox1.CheckState.ToString(); 
 }
 

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft