# CheckBox

## Content



CheckBox lets user choose from a list of options by checking or un-checking them. User can select either single or multiple options from the list. The [C1CheckBox](/componentone/docs/win/online-input-net/) class provides a **Boolean** property, [Checked](/componentone/docs/win/online-input-net/), to get or set the value of a checkbox with two states. You can also create a three-state checkbox with three states as Checked, Unchecked and Indeterminate by setting the [ThreeState](/componentone/docs/win/online-input-net/) property to **true**. In such case, you can get the checked state using [CheckState](/componentone/docs/win/online-input-net/) property which returns the current state of a checkbox.

| Default CheckBox | Toggle Button (Appearance = Button) | Three-state CheckBox (ThreeState = true) |
| --- | --- | --- |
| ![Default CheckBox](https://cdn.mescius.io/document-site-files/images/287a0e06-68cb-453e-816c-125f892133e7/images/check-normal.png) | ![Toggle Button (Appearance = Button)](https://cdn.mescius.io/document-site-files/images/287a0e06-68cb-453e-816c-125f892133e7/images/check-button.png) | ![Three-state CheckBox (ThreeState = true)](https://cdn.mescius.io/document-site-files/images/287a0e06-68cb-453e-816c-125f892133e7/images/check-three-state.png) |

```CREATE
chk = new C1CheckBox();
Controls.Add(chk);
chk.TextImageRelation = TextImageRelation.ImageAboveText;
chk.ThreeState = true;
chk.Text = "Enable";
chk.Value = true;
chk.Location = new Point(10, 50);
```

You can display a checkbox in the form of a toggle button as well by setting the [Appearance](/componentone/docs/win/online-input-net/) property to **Button**. The **C1CheckBox** also lets you set an [Image](/componentone/docs/win/online-input-net/) on the control. You can set the [TextAlign](/componentone/docs/win/online-input-net/) and [ImageAlign](/componentone/docs/win/online-input-net/) properties to position the text and image respectively. You can also set the [TextImageRelation](/componentone/docs/win/online-input-net/) property to specify the position of image in respect to the text. You can also choose to set icon in the control using the [Icon](/componentone/docs/win/online-input-net/) property which supports bitmap, font and vector icons.

### Data Binding

Binding a control with a data source gives you ability to communicate and even update the underlying data through the control. The CheckBox control can be bound to Boolean, String, and Integer fields of a data source using [DataSource](/componentone/docs/win/online-input-net/) property. You can specify the field to be bound to CheckBox using the [DataMember](/componentone/docs/win/online-input-net/) property.

```DATA
c1CheckBox1.DataSource = bSource;
c1CheckBox1.DataMember = "Discontinued";
```

By default, [DataType](/componentone/docs/win/online-input-net/) property of checkbox value is set to **Boolean** type. However, if you want to bind checkbox to a string or an integer type field, you can set the DataType property to string or int and then use the [TranslateValues](/componentone/docs/win/online-input-net/) property to convert the boolean value of checkbox into a string or an integer.