Link to home
Start Free TrialLog in
Avatar of Torrwin
TorrwinFlag for United States of America

asked on

Determine Exception Type

Hello,

I have a 3rd party control that has an Error() event.

One of the arguments for the error event is Control.ErrorEventArgs.

So, if I wanted to see what type of exception occured, I could use:
MsgBox(e.Exception.GetType.ToString)

My question is: How do I write an IF statement to handle specific errors?  I can't use a catch block because this is an event.

The following does not work because "'FormatException' is a type in 'System' and cannot be used as an expression":
If e.Exception.GetType Is System.FormatException Then...

Thanks,
-Torrwin
ASKER CERTIFIED SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial