B
Brian
I have done something and I need to figure out how to undo it.
I somehow have turned off exceptions. Let me explain with an example.
I put some code into a form's textbox's DragDrop event handler.
It does the following cast:
this.Filename.text = (string) e.Data.GetData(DataFormats.FileDrop);
When I run the form and do a drag drop, nothing happens. So, I then wrapped
it around a try block:
try
{
this.Filename.text = (string) e.Data.GetData(DataFormats.FileDrop);
}
catch (Exception ex)
{
this.Filename.Text = "Unknown file.";
}
and guess what, the exception handling code runs! It says there that the
cast to string is invalid.
That's fine, but my question is, why didn't an "unhandled exception" box
pop up when it wasn't wrapped in a try block. Shouldn't my program have
died?
What's up?
--Brian
I somehow have turned off exceptions. Let me explain with an example.
I put some code into a form's textbox's DragDrop event handler.
It does the following cast:
this.Filename.text = (string) e.Data.GetData(DataFormats.FileDrop);
When I run the form and do a drag drop, nothing happens. So, I then wrapped
it around a try block:
try
{
this.Filename.text = (string) e.Data.GetData(DataFormats.FileDrop);
}
catch (Exception ex)
{
this.Filename.Text = "Unknown file.";
}
and guess what, the exception handling code runs! It says there that the
cast to string is invalid.
That's fine, but my question is, why didn't an "unhandled exception" box
pop up when it wasn't wrapped in a try block. Shouldn't my program have
died?
What's up?
--Brian