static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) { MessageBox.Show("Unhandled Exception: " + e.ExceptionObject.ToString(), "Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); }