DataGridView的DataGridViewCheckBox问题

时间:2014-06-12 16:06:16   收藏:0   阅读:259

datagridview有一列DataGridViewCheckBox,但连续点击的话(1秒点击N次),会导致出错,数据处理不正确,感觉

private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) {}的没处理完,一般处理方法就是再加个doubleclick事件

private void dgv_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) {
     dgv_CellContentClick(sender, e);
     dgv_CellContentClick(sender, e);
}
上面一般能解决问题,但是我在实际过程中还是有点问题,所以我会用下面的方法
private void dgv_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) {
     dgv_CellContentClick(sender, e); //只执行一次
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
       {
           try
           {
               dgv.Enable = false;
               ........
           }
           catch (Exception ex)
           {
           }
           finally
           {
               dgv.Enable = true;
           }
       }

  

 

DataGridView的DataGridViewCheckBox问题,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!