Пример #1
0
        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            Exception ex = e.Exception as Exception;
            if (ex != null)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.AppendLine("异常消息:\r\n"+ex.Message);
                sb.AppendLine("调用堆栈:\r\n" + ex.StackTrace);

                if (ex.InnerException != null)
                {
                    sb.AppendLine("内部异常消息:\r\n" + ex.InnerException.Message);
                    sb.AppendLine("内部异常堆栈:\r\n" + ex.InnerException.StackTrace);
                }
                DbTool.DbForms.FrmError error = new DbTool.DbForms.FrmError(sb.ToString());
                error.ShowDialog();
                //MessageBox.Show(sb.ToString());
            }
            else
            {
                MessageBox.Show(Convert.ToString(e.Exception));
            }
        }
Пример #2
0
        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            Exception ex = e.Exception as Exception;

            if (ex != null)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.AppendLine("异常消息:\r\n" + ex.Message);
                sb.AppendLine("调用堆栈:\r\n" + ex.StackTrace);

                if (ex.InnerException != null)
                {
                    sb.AppendLine("内部异常消息:\r\n" + ex.InnerException.Message);
                    sb.AppendLine("内部异常堆栈:\r\n" + ex.InnerException.StackTrace);
                }
                DbTool.DbForms.FrmError error = new DbTool.DbForms.FrmError(sb.ToString());
                error.ShowDialog();
                //MessageBox.Show(sb.ToString());
            }
            else
            {
                MessageBox.Show(Convert.ToString(e.Exception));
            }
        }