Settings in WinForms CheckBox
18 Nov 20182 minutes to read
This section discusses the various states of the WinForms CheckBox control and the method of associating values with the states.
WinForms CheckBox States
The WinForms CheckBox states can be changed by using CheckState or Checked property.
| WinForms CheckBox Property | Description |
|---|---|
| CheckState | Gets or sets the check state of the WinForms CheckBox. It includes Unchecked,Checked and Indeterminate options. |
| Checked | Gets or sets the checked state of the WinForms CheckBox. |
this.checkBoxAdv1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxAdv1.Checked = true;Me.checkBoxAdv1.CheckState = System.Windows.Forms.CheckState.Checked
Me.checkBoxAdv1.Checked = True
See Also
Image Settings of WinForms CheckBox
WinForms CheckBox Values
You can customize the values associated with the various check states of WinForms CheckBox control. Both integer and string values can be associated with the check states.
| WinForms CheckBox Properties | Description |
|---|---|
| CheckedInt | Specifies the integer value when checked. |
| CheckedString | Specifies the string value when checked. |
| IndeterminateInt | Specifies the integer value when indeterminate. |
| IndeterminateString | Specifies the string value when indeterminate. |
| UncheckedInt | Specifies the integer value when Unchecked. |
| UncheckedString | Specifies the string value when Unchecked. |
| StringValue | Gets or sets the string value. |
| BoolValue | Gets or sets a value indicating the check state. This property can be set to use bool values for data binding. Refer . |
| IntValue | Gets or sets the int value. Refer |
this.checkBoxAdv1.CheckedInt = 3;
this.checkBoxAdv1.CheckedString = "CheckBoxAdv is Checked";
this.checkBoxAdv1.IndeterminateInt = 5;
this.checkBoxAdv1.IndeterminateString = "CheckBoxAdv is Indeterminate";
this.checkBoxAdv1.UncheckedInt = 3;
this.checkBoxAdv1.UncheckedString = "CheckBoxAdv is Unchecked";
this.checkBoxAdv1.StringValue = "String";
this.checkBoxAdv1.IntValue = 5;
this.checkBoxAdv1.BoolValue = true;Me.checkBoxAdv1.CheckedInt = 3
Me.checkBoxAdv1.CheckedString = "CheckBoxAdv is Checked"
Me.checkBoxAdv1.IndeterminateInt = 5
Me.checkBoxAdv1.IndeterminateString = "CheckBoxAdv is Indeterminate"
Me.checkBoxAdv1.UncheckedInt = 3
Me.checkBoxAdv1.UncheckedString = "CheckBoxAdv is Unchecked"
Me.checkBoxAdv1.StringValue = "String"
Me.checkBoxAdv1.IntValue = 5
Me.checkBoxAdv1.BoolValue = True