C#捕获异常崩溃时
Application.EnableVisualStyles(); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); ; Application.SetCompatibleTextRenderingDefault(false); Application.Run(new main()); } static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { MessageBox.Show("程序需要重新启动:" + e.Exception.Message);//捕获到的异常 } }
-------此处无银三百两------