简体   繁体   English

为什么我的Application.Exit(); 通话失败?

[英]Why does my Application.Exit(); call fail?

I am coding in C#, and I have an exit button on my form that calls Application.Exit(); 我正在用C#进行编码,并且我的窗体上有一个退出按钮,它调用Application.Exit();。 Now most of the time the button works without an issue at all, but occasionally the program doesn't seem to recognize that the program is being told to close, as if the button doesn't work any longer? 现在,大多数情况下按钮完全没有问题,但是有时程序似乎无法识别正在告诉程序关闭,好像按钮不再起作用了吗? There are no errors being thrown it just seems that the button doesn't register that its being clicked, even though visibly it shows the button being pressed. 似乎没有显示该按钮被按下的迹象,但似乎没有显示该按钮没有被单击,因此不会引发任何错误。 The most recent issue with the exit button came after the program sat for 20 minutes and then I told it to exit. 退出按钮最近的问题是程序停顿了20分钟之后,然后我告诉它退出了。 Thanks for any thoughts on the matter. 感谢您对此事的任何想法。

Application.Exit() does not necessarily force an application to exit immediately. Application.Exit()不一定强制应用程序立即退出。 Here's a nice breakdown of Application.Exit() vs Enivronment.Exit(): 这是Application.Exit()与Enivronment.Exit()的详细分类:

http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx

And of course the MSDN official word: 当然,MSDN的官方用语是:

http://msdn.microsoft.com/en-us/library/ms157894.aspx http://msdn.microsoft.com/en-us/library/ms157894.aspx

Other than those thoughts, we'd need to see the code to give advise on what precisely is going on with your application. 除了这些想法之外,我们还需要查看代码以就您的应用程序到底发生了什么提供建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM