关闭c#winforms应用程序 [英] closing c# winforms application

查看:102
本文介绍了关闭c#winforms应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





当我通过单击X(关闭)关闭表单时,我调试应用程序跟踪时如下:

  private   void  Form1_FormClosing( object  sender, FormClosingEventArgs e)
{
Application.Exit();
}



接下来转到DIspose()

  protected  覆盖  void  Dispose( bool 处置)
{
if (处理&&(components!= null ))
{
components.Dispose();
}
base .Dispose(disposing);
}



接下来转到program.cs

 Application.Run( ConnectObj); 

声明



我的应用程序是runnung background当我点击表格顶部取消时如何退出应用程序



表单已关闭,但在任务管理器中它正在运行。如何退出

解决方案

如果你有后台进程,请尝试

 System.Diagnostics.Process.GetCurrentProcess ()。kill(); 



了解更多信息参考此答案 [ ^ ]


Hi,

when i close the form by clicking X (close), when i debug the application tracing is as follows:

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
       {
           Application.Exit();
       }


and next goes to DIspose()

protected override void Dispose(bool disposing)
       {
           if (disposing && (components != null))
           {
               components.Dispose();
           }
           base.Dispose(disposing);
       }


next goes to program.cs

Application.Run(ConnectObj);

statement

and my application is runnung background how to exit the application when i click cancel at top of the form

form is closed but in task manager it is running. how to exit

解决方案

if you have background processes, try

System.Diagnostics.Process.GetCurrentProcess().Kill();


for more information Refer this Answers[^]


这篇关于关闭c#winforms应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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