I have a DataGridView that's populated and bound dynamically. One column is a CheckBoxColumn.
How can I progr开发者_开发技巧ammatically check individual boxes within that column?
You can set the value of the cell to true
or false
to check or uncheck it respectively:
// check the 2nd row
dataGridView1.Rows[1].Cells[0].Value = true;
If the column is not being bound to bool
values, you can set the cell value according to the values set for TrueValue, FalseValue, and IndeterminateValue on the DataGridViewCheckBoxColumn
.
精彩评论