CheckBoxColumn

Hosts a collection of DataGridViewCheckBoxCell objects.

The DataGridViewCheckBoxColumn class is a specialized type of the DataGridViewColumn class used to logically host cells that indicate binary state. A DataGridViewCheckBoxColumn has an associated DataGridViewCheckBoxCell in every DataGridViewRow that intersects it. Each cell supplies a user interface (UI) that is similar to a CheckBox control.

The default sort mode for this column type is NotSortable.

Typically, check box cell values are intended either for storage, like any other data, or for performing bulk operations. If you want to respond immediately when users click a check box cell, you can handle the DataGridView.CellContentClick event, but this event occurs before the cell value is updated. If you need the new value at the time of the click, one option is to calculate what the expected value will be based on the current value. Another approach is to commit the change immediately, and handle the DataGridView.CellValueChanged event to respond to it.

For a full list of properties, methods and events see the API documentation.

Features

Three State

The ThreeState property defines whether the checkbox cells will allow three check states or the default two check states.

Sorting

The DataGridViewCheckBoxColumn can also be sorted according to the cells value in ascending or descending order:

Last updated