开发者

how to set checked attribute to a box in CheckBoxColumn

开发者 https://www.devze.com 2023-01-23 21:46 出处:网络
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

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

精彩评论

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