码迷,mamicode.com
首页 > Windows程序 > 详细

DataGridView的DataGridViewCheckBox问题

时间:2014-06-12 16:06:16      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:datagridview   class   blog   code   tar   com   

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

DataGridView的DataGridViewCheckBox问题

标签:datagridview   class   blog   code   tar   com   

原文地址:http://www.cnblogs.com/JohnnyBao/p/3782082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!