ITPub博客

首页 > Linux操作系统 > Linux操作系统 > winform错误信息提示的代码

winform错误信息提示的代码

原创 Linux操作系统 作者:fangqm 时间:2010-04-01 05:32:42 0 删除 编辑
winform错误信息提示的代码
using System;
using System.Collections.Generic;
using System.Text;
namespace fangqm.NetBank.UI
{
    class ErrorHandler
    {
        internal static void OnError(Exception ex)
        {
            if (ex.GetType() == typeof(ApplicationException) ||
                ex.GetType().IsSubclassOf(typeof(ApplicationException)))
            {
                System.Windows.Forms.MessageBox.Show(
                    ex.Message, "提示信息!",
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Information);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(
                    ex.Message + "\r\n\r\n" + ex.StackTrace, "系统错误!",
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
    }
}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23109131/viewspace-630980/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 正则表达式
请登录后发表评论 登录
全部评论
创业项目 https://u.rscode.cn

注册时间:2010-03-24

  • 博文量
    297
  • 访问量
    784624