如何在不发生C#的情况下运行事件 [英] How to run an event without happening C#

查看:71
本文介绍了如何在不发生C#的情况下运行事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要执行表单事件而不会发生这种情况。



例如;



frmOrderNew是表格。



I need to perform a forms Event without making that happen.

For Example;

frmOrderNew is the form.

private void frmOrderNew_FormClosing(object sender, FormClosingEventArgs e)





如何以编程方式实现此目的。



How to programatically achieve this.

推荐答案

如评论中所述,您需要将要调用的任何代码移动到自己的方法中。然后,您可以随时在FormClosing的事件中调用它。这是正确的方法。
As mentioned in comments, you need to move whatever code you want to call into its own method. Then you can call it whenever you want including in the event for FormClosing. That is the proper way to do it.


http://stackoverflow.com/a/12185598 [ ^ ]


这篇关于如何在不发生C#的情况下运行事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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