我已将数据表绑定到DataGridView
,该数据表有一个名为“状态”的列,其类型为Boolean
。我可以通过代码将值设置为true
或false
就好了。
但是,我不知道如何检查给定的行是否已经被检查。这是我尝试使用的代码,编译它显示错误“指定的演员表无效”。
任何帮助,将不胜感激。
if (rowIndex >= 0)
{
var cbxCell = (DataGridViewCheckBoxCell)dgvScan.Rows[rowIndex].Cells["Status"];
if ((bool)cbxCell.Value)
{
// Do stuff
}
else
{
// Do other stuff
}
}