to a windows program you can add the following for error handling in program.cs
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.UnhandledException
+=
new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//CheckForShortcut();
Application.Run(new Invoice());
}
static void CurrentDomain_UnhandledException
(object
sender, UnhandledExceptionEventArgs e)
{
try
{
Exception
ex = (Exception)e.ExceptionObject;
MessageBox.Show(ex.Message
+ ex.StackTrace,
"Fatal
Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
Application.Exit();
}
}
No comments:
Post a Comment