我有 DataGridView 由数据表绑定,我有相同的复选框。
我想导航或循环浏览 datagridview 并选中这些复选框,下面是我使用的语法。
foreach(DataGridViewRow dr in dgvColumns.Rows)
{
DataGridViewCheckBoxCell checkCell =
(DataGridViewCheckBoxCell)dr.Cells["CheckBoxes"];
checkCell.Value=1;
//Also tried checkCell.Selected=true;
//Nothing seems to have worked.!
}
以下对我有用,它完美地检查了复选框:)
foreach (DataGridViewRow row in dgvDataGridView.Rows)
{
((DataGridViewCheckBoxCell)row.Cells[0]).Value = true;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)