static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += (System.Threading.ThreadExceptionEventHandler)delegate(object sender, System.Threading.ThreadExceptionEventArgs e)
{
//这里处理线程异常
};
AppDomain.CurrentDomain.UnhandledException += (UnhandledExceptionEventHandler)delegate(object sender, UnhandledExceptionEventArgs e)
{
//这里处理其他未捕获的异常信息
};
Application.Run(new Mainform());
}
catch(Exception ex)
{
//这里处理标准异常
}
}
}
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += (System.Threading.ThreadExceptionEventHandler)delegate(object sender, System.Threading.ThreadExceptionEventArgs e)
{
//这里处理线程异常
};
AppDomain.CurrentDomain.UnhandledException += (UnhandledExceptionEventHandler)delegate(object sender, UnhandledExceptionEventArgs e)
{
//这里处理其他未捕获的异常信息
};
Application.Run(new Mainform());
}
catch(Exception ex)
{
//这里处理标准异常
}
}
}