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); //只执行一次
}
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { dgv.Enable = false; ........ } catch (Exception ex) { } finally { dgv.Enable = true; } }