事件冲突 [英] Events Conflicts

查看:55
本文介绍了事件冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

真的这是一个可耻的问题,但我会问如何,如果我按照报告生成使用Row_Enter事件在datagridview上选择行搜索方法会引发错误,因为在表单加载时加载了一些数据(同时datagridview也是
描绘了一些数据)并且在很多错误之后它没有任何错误,我的问题如何阻止Row_Enter事件同时搜索方法有效吗?

Really it is shamefull question but i will ask any how ,if i made report generating according to selected row on datagridview using Row_Enter event the search methods raise up bugs because some data loaded while form loading (also while datagridview also paints some data) and after many bugs it works without any bugs ,My problem how prevent Row_Enter event while search methods working?

谢谢

Esmat

推荐答案

在表单中添加一些布尔成员,例如:

  
bool f = false;

   bool f = false;

然后在
Row_Enter 处理程序中检查它:

Then check it inside the Row_Enter handler:

  
如果(f)返回;

   。 。 。

   if( f ) return;
   . . .

如果是
false Row_Enter 将正常执行。但是,如果要禁用
Row_Enter 以执行某些特殊操作,请将其设置为
true
,然后再返回 false

If it is false, the Row_Enter will be executed normally. But if you want to disable Row_Enter in order to perform some special operations, then set it to true, then back to false:

  
f = true;

   做一些特殊操作......

   f = false;

   f = true;
   do some special operations…
   f = false;





这篇关于事件冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆