我在尝试处理
上的FormClosing时遇到错误Environment.Exit(0);
System.ComponentModel.Win32Exception未处理
HResult = -2147467259消息=创建窗口句柄时出错 Source = System.Windows.Forms ErrorCode = -2147467259
NativeErrorCode = 1406 StackTrace: 在System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) 在System.Windows.Forms.Control.CreateHandle() 在System.Windows.Forms.ComboBox.CreateHandle() 在System.Windows.Forms.Control.get_Handle() 在System.Windows.Forms.ComboBox.WndProc(消息& m) 在System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)InnerException:
private void F0103_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result;
result = MessageBox.Show("are you sure you want to exit", "quite confrimation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
Environment.Exit(0);
}
else
{ e.Cancel = true; }
}
我尝试将Environment.Exit(0);
更改为以下但我失败了
Environment.Exit(1);
Application.Exit();