G
GaryDean
I'm trying to capture all unhandled exceptions in my Forms Application.
First I subscribe to ThreadException ...
public Form1()
{
InitializeComponent();
Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Then I define a method to handle the event....
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs ue)
{
Exception myEx = (Exception)ue.ExceptionObject;
here I write to the database logging exception details - the data gets
written ok
To force an exception I put a button on my form and I handle the click as
.....
private void btnBlow_Click(object sender, EventArgs e)
{
decimal dec = Convert.ToDecimal("MakeException"); //cause an
exception
}
The intentional exception triggers my method just fine. But then the
btnBlow_click gets triggered again - over and over forever. I don't know why
that is happening.
thanks,
Gary
First I subscribe to ThreadException ...
public Form1()
{
InitializeComponent();
Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Then I define a method to handle the event....
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs ue)
{
Exception myEx = (Exception)ue.ExceptionObject;
here I write to the database logging exception details - the data gets
written ok
To force an exception I put a button on my form and I handle the click as
.....
private void btnBlow_Click(object sender, EventArgs e)
{
decimal dec = Convert.ToDecimal("MakeException"); //cause an
exception
}
The intentional exception triggers my method just fine. But then the
btnBlow_click gets triggered again - over and over forever. I don't know why
that is happening.
thanks,
Gary