Torrwin
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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.