xiaoben

博客园 首页 新随笔 联系 订阅 管理
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); // if no, do not catch UI thread exception
  
          void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception exception = e.ExceptionObject as Exception;
           // Write log or do other opts.
        } 
 
 MSDN: http://msdn.microsoft.com/en-us/library/ms954599.aspx

posted on 2008-07-14 16:33  汪永成  阅读(305)  评论(0)    收藏  举报