<bdo id='9MiKT'></bdo><ul id='9MiKT'></ul>
    <tfoot id='9MiKT'></tfoot>

      <small id='9MiKT'></small><noframes id='9MiKT'>

      <legend id='9MiKT'><style id='9MiKT'><dir id='9MiKT'><q id='9MiKT'></q></dir></style></legend>

      1. <i id='9MiKT'><tr id='9MiKT'><dt id='9MiKT'><q id='9MiKT'><span id='9MiKT'><b id='9MiKT'><form id='9MiKT'><ins id='9MiKT'></ins><ul id='9MiKT'></ul><sub id='9MiKT'></sub></form><legend id='9MiKT'></legend><bdo id='9MiKT'><pre id='9MiKT'><center id='9MiKT'></center></pre></bdo></b><th id='9MiKT'></th></span></q></dt></tr></i><div id='9MiKT'><tfoot id='9MiKT'></tfoot><dl id='9MiKT'><fieldset id='9MiKT'></fieldset></dl></div>
      2. 防止调用下一个事件处理程序

        Prevent next event handler being called(防止调用下一个事件处理程序)
          • <bdo id='t60Nj'></bdo><ul id='t60Nj'></ul>

              <tbody id='t60Nj'></tbody>

              <small id='t60Nj'></small><noframes id='t60Nj'>

            1. <tfoot id='t60Nj'></tfoot>
            2. <i id='t60Nj'><tr id='t60Nj'><dt id='t60Nj'><q id='t60Nj'><span id='t60Nj'><b id='t60Nj'><form id='t60Nj'><ins id='t60Nj'></ins><ul id='t60Nj'></ul><sub id='t60Nj'></sub></form><legend id='t60Nj'></legend><bdo id='t60Nj'><pre id='t60Nj'><center id='t60Nj'></center></pre></bdo></b><th id='t60Nj'></th></span></q></dt></tr></i><div id='t60Nj'><tfoot id='t60Nj'></tfoot><dl id='t60Nj'><fieldset id='t60Nj'></fieldset></dl></div>

              • <legend id='t60Nj'><style id='t60Nj'><dir id='t60Nj'><q id='t60Nj'></q></dir></style></legend>
                  本文介绍了防止调用下一个事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有两个事件处理程序连接到 Windows 窗体中的按钮单击,如下所示:

                  I have two event handlers wired up to a button click in a Windows form like so:

                  this.BtnCreate.Click += new System.EventHandler(new RdlcCreator().FirstHandler);
                  this.BtnCreate.Click += new System.EventHandler(this.BtnCreate_Click);
                  

                  两者都被正确调用.

                  但是,是否可以在 FirstHandler() 中阻止 BtnCreate_Click() 被执行?比如:

                  However is it possible within FirstHandler() to prevent BtnCreate_Click() being executed? Something like:

                  void FirstHandler(object sender, EventArgs e)
                  {
                     if (ConditionSatisfied)
                       //Prevent next handler in sequence being executed
                  
                  }
                  

                  我知道我可以取消订阅该事件,但这可以通过编程方式(在方法内)完成吗?

                  I know I could just unsubscribe the event, but can this be done programmatically (from within the method)?

                  推荐答案

                  据我所知,没有解决方案.这是因为无法保证事件发生时调用事件处理程序的顺序.

                  As far as I know there is no solution for this. That's because there is no guarantee for the order in which the event handlers are called when the event happens.

                  因此,您不应该以任何方式依赖他们的订单.

                  Because of that you are not supposed to rely on their order in any way.

                  这篇关于防止调用下一个事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  IBM.Data.DB2.Core connection problems(IBM.Data.DB2.Core 连接问题)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  Datetime field overflow with IBM Data Server Client v9.7fp5(IBM Data Server Client v9.7fp5 的日期时间字段溢出)
                  Using entity Framework with .NET Core and DB2(将实体框架与 .NET Core 和 DB2 结合使用)
                  <i id='2EITh'><tr id='2EITh'><dt id='2EITh'><q id='2EITh'><span id='2EITh'><b id='2EITh'><form id='2EITh'><ins id='2EITh'></ins><ul id='2EITh'></ul><sub id='2EITh'></sub></form><legend id='2EITh'></legend><bdo id='2EITh'><pre id='2EITh'><center id='2EITh'></center></pre></bdo></b><th id='2EITh'></th></span></q></dt></tr></i><div id='2EITh'><tfoot id='2EITh'></tfoot><dl id='2EITh'><fieldset id='2EITh'></fieldset></dl></div>
                    <tbody id='2EITh'></tbody>
                  <legend id='2EITh'><style id='2EITh'><dir id='2EITh'><q id='2EITh'></q></dir></style></legend>

                  • <bdo id='2EITh'></bdo><ul id='2EITh'></ul>
                    • <tfoot id='2EITh'></tfoot>

                      <small id='2EITh'></small><noframes id='2EITh'>