Articles in this section
Category / Section

How to pre-select a checkbox inside a WinForms Grid cell?

1 min read

In order to pre-select the checkbox in a WinForms grid cell, CellValue can be used to set value for the CheckBox. It is depending upon the values of CheckBoxOptions.CheckedValue and CheckBoxOptions.UncheckedValue. Because these properties hold the values for selecting the checkbox.

Code Snippet


//Sets the cell type as Checkbox.
this.gridControl1[row, col].CellType = "CheckBox";
//Sets the Checked and Unchecked values for the checkbox.
this.gridControl1[row, col].CheckBoxOptions.CheckedValue = "true";
this.gridControl1[row, col].CheckBoxOptions.UncheckedValue = "false";
//Sets the type of the cell value as bool.
this.gridControl1[row, col].CellValueType = typeof(bool);
//Sets the Cell value.
this.gridControl1[row, col].CellValue = true;



'Sets the cell type as Checkbox.
Me.gridControl1(row, col).CellType = "CheckBox"
'Sets the Checked and Unchecked values for the checkbox.
Me.gridControl1(row, col).CheckBoxOptions.CheckedValue = "true"
Me.gridControl1(row, col).CheckBoxOptions.UncheckedValue = "false"
'Sets the type of the cell value as bool.
Me.gridControl1(row, col).CellValueType = GetType(Boolean)
'Sets the Cell value.
Me.gridControl1(row, col).CellValue = True



Showing preselected checkbox


Sample Link:

C#: Preselecting_CheckBox_CS

VB: Preselecting_CheckBox_VB




I hope you enjoyed learning about how to pre-select a checkbox inside a WinForms Grid cell.

You can refer to our WinForms GridControl feature tour page to learn about its other groundbreaking feature representations. You can also explore ourdocumentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied