private void Q24183289_Click(object sender, EventArgs e)
{
int i = 0;
int j = 0;
int result = i / j; // raises DivideByZeroException unhandled
}
private void Q24183289_Click(object sender, EventArgs e)
{
//AppDomain.CurrentDomain.UnhandledException += // CLR
// new UnhandledExceptionEventHandler(OnUnhandledException);
Application.ThreadException += // Windows Forms
new System.Threading.ThreadExceptionEventHandler(
OnGuiUnhandedException);
int i = 0;
int j = 0;
int result = i / j; // throws exception
}
// Windows Forms unhandled exception
public static void OnGuiUnhandedException(Object sender,
System.Threading.ThreadExceptionEventArgs e)
{
throw new InvalidOperationException(
"Invalid operation.");
}