using system;
using system.collections.generic;
using system.linq;
using system.windows.forms;
using system.io;
namespace ordersplit
catch (exception ex)
\r\n異常訊息:\r\n異常資訊:\r\n",
ex.gettype().name, ex.message, ex.stacktrace);
writelog(str);
messagebox.show("發生錯誤,請檢視程式日誌!", "系統錯誤", messageboxbuttons.ok, messageboxicon.error);
environment.exit(0);}}
/// ///錯誤彈窗
///
///
///
\r\n異常訊息:\r\n異常資訊:\r\n",
error.gettype().name, error.message, error.stacktrace);
}else
", e);
}writelog(str);
messagebox.show("發生錯誤,請檢視程式日誌!", "系統錯誤", messageboxbuttons.ok, messageboxicon.error);
environment.exit(0);
}static void currentdomain_unhandledexception(object sender, unhandledexceptioneventargs e)
/// /// 寫檔案
///
///
static void writelog(string str)
using (var sw = new streamwriter(@"errlog\errlog.txt", true))}}
}
C winform 捕獲全域性異常
using system using system.collections.generic using system.windows.forms using system.io namespace gobalexception catch exception ex r n異常訊息 r n異常資訊 r...
C WINFORM 捕獲全域性異常
using system using system.collections.generic using system.windows.forms using system.io namespace gobalexception r n異常訊息 r n異常資訊 r n ex.gettype name,...
C winform 捕獲全域性異常
using system using system.collections.generic using system.windows.forms using system.io namespace gobalexception r n異常訊息 r n異常資訊 r n ex.gettype name,...