[STAThread] static void Main(string[] args) { // Creates an instance of the methods that will handle the exception. CustomExceptionHandler eh = new CustomExceptionHandler(); // Adds the event handler to to the event. Application.ThreadException += new ThreadExceptionEventHandler(eh.OnThreadException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.Run(new MainForm()); } // Creates a class to handle the exception event. internal class CustomExceptionHandler { // Handles the exception event. public void OnThreadException(object sender, ThreadExceptionEventArgs t) { DialogResult result = this.ShowThreadExceptionDialog(t.Exception); // Exits the program after displaying message to the user. // In Development mode, the developer will have more options (Abort/Retry/Ignore). if (result == DialogResult.OK || result == DialogResult.Abort) Application.Exit(); } // Creates the error message and displays it. private DialogResult ShowThreadExceptionDialog(Exception e) { DialogResult retval; string msgUser = "An error occurred please contact the adminstrator with the following information:\n\n"; string msgDev = "An unhandled exception occurred (Abort/Retry/Ignore buttons are only displayed to Developers) \n\n"; string msgTrace = "Error: " + e.Message + "\n\n"; if (e.InnerException != null) msgTrace += " " + e.InnerException.Message + "\n\n"; msgTrace += "Error Method: " + e.TargetSite + "\n\n" + "Stack Trace: " + e.StackTrace; if (System.Diagnostics.Debugger.IsAttached) retval = MessageBox.Show(msgDev + msgTrace, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation); else retval = MessageBox.Show(msgUser + msgTrace, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); return retval; } }You'll notice that in my example, I only allow the user to Retry or Ignore if they're the developer and debugging. I assume that in such a case, the developer will want to see right off the bat what went wrong and where, but if this happens to a real user, it's typically NOT a good idea to allow them to continue, as it may easily lead to further corruption of data. You can also expand on this class to add error-logging or whatever you wish.