开发者

how to set checked attribute to a box in CheckBoxColumn

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜