[英]FormClosing shows Exit Confirm MessageBox two times
I am facing a problem on form closing. 我在关闭表单时遇到问题。 It's shows my exit confirm message box 2 times and and ask 2 times "Are you sure to exit?":
它显示2次我的退出确认消息框,并询问2次“确定要退出吗?”:
if (MessageBox.Show("Are you sure to exit. Confirm?", "Rest O Rant", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
Application.Exit();
MessageBox.Show("Thank You For Using Rest O Rant Software.", "Closing message!", MessageBoxButtons.OK);
}
else
{
e.Cancel = true;
this.Activate();
}
try this code 试试这个代码
MessageBox.Show("Thank You For Using Rest O Rant Software.", "Closing message!", MessageBoxButtons.OK);
Application.Exit();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.