[英]End a task if the windows form is also terminated through task manager
我打开MS Access时弹出一个登录窗体。 如果用户决定离开,我有一个取消按钮,关闭应用程序和MS Access:
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
但我还想补充一点,如果用户终止Windows窗体,它也将终止MS Access。
即,如果windowForm终止,则表示Application.Exit
将函数添加到FormClosing
的“事件属性”中的FormClosing
事件或手动:
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
然后写:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.