public static void UnhandledExceptionHandler(Exception e) { try { // Create Error Message string message = string.Format("An Application Error has occurred.\r\n\r\nEXCEPTION:\r\nSource: {0}\r\nMessage: {1}\r\n", e.Source, e.Message); if (e.InnerException != null) { message += string.Format("\r\nINNER EXCEPTION:\r\nSource: {0}\r\nMessage: {1}\r\n", e.InnerException.Source, e.InnerException.Message); } message += string.Format("\r\nSTACK TRACE:\r\n{0}", e.StackTrace); frmShowError fshow = new frmShowError(); fshow.settype(message); fshow.ShowDialog(); } catch { } }
public static void UnhandledExceptionHandler(string e1) { try { // Create Error Message string message = "An Application Error has occurred.\r\n\r\nEXCEPTION:\r\nMessage:"; message += e1 + "\r\n"; message += string.Format("\r\nSTACK TRACE:\r\n{0}", Environment.StackTrace); frmShowError fshow = new frmShowError(); fshow.settype(message); fshow.ShowDialog(); Environment.Exit(0); } catch { Environment.Exit(0); } }