日期:2014-05-18 浏览次数:21066 次
private void lblAddDevice_Click(object sender, EventArgs e)
{
for (int i = 0; i < dgvDevice.Rows.Count;i++ )
{
DataGridViewCheckBoxCell chkCell = (DataGridViewCheckBoxCell)dgvDevice.Rows[i].Cells["Check"];
Boolean flag = Convert.ToBoolean(chkCell.Value);
if (flag)
{
CurrencyManager cm = (CurrencyManager)BindingContext[this.dgvDevice.DataSource];
cm.SuspendBinding();
dgvDevice.Rows[i].Visible = false;
cm.ResumeBinding();
//disAbleCheck(i);
}
}
}
bool flag = Convert.ToBoolean(chkCell.EditedFormattedValue);
------解决方案--------------------
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells["Check"];
if ((Boolean)chk.EditedFormattedValue == true)
{
}
}