利用DataGridView的checkbox进行选择性删除,操作成功后checkbox的勾仍在上面,怎么去掉啊?
我用
for(int i =0; i< this.dgv.RowCount; i++)
{
if((bool)this.dgv.Rows[i].Cells[0].EditedFormattedValue == true)
{
this.dgv.Rows[i].Cells[0].Value = false;
}
}
怎么不行啊?
我用
for(int i =0; i< this.dgv.RowCount; i++)
{
if((bool)this.dgv.Rows[i].Cells[0].EditedFormattedValue == true)
{
this.dgv.Rows[i].Cells[0].Value = false;
}
}
怎么不行啊?
{
if((bool)this.dgv.Rows[i].Cells[0].EditedFormattedValue == true)
{
this.dgv.Rows[i].Cells[0].Value = false;
}else
{
this.dgv.Rows[i].Cells[0].Value = true;}
}
是全选和取消全选吧?
{
this.dataGridView1[0, i].Value = false;
}
你这样试试,我这是没问题的
{
datagridviewcheckboxcell c=(datagridviewcheckboxcell)r.cells[0];
c.checked=true;
}
(this.myDataGridView[0,i] as DataGridViewCheckBoxCell).value = false;