I have this code:
private void btn1_Click(object sender, EventArgs e)
{
try
{
Thrower();
}
catch
{
MessageBox.Show("exception caught");
}
}
Which calls this method:
private void Thrower()
{
throw new OverflowException();
}
Well I'm not very experienced when it comes to exception handling, but I would have thought that this message box ("exception caught") would show here. It doesn't. Should it be? If not, what am I doing wrong? Have I misunderstood how this is supposed to work?
Thanks.
I tested this and it works fine for me. Are you sure you sure the btn1_Click
method is actually being called? Maybe you forgot to wire up your events?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With