• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1315
  • Last Modified:

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
0
Torrwin
Asked:
Torrwin
1 Solution
 
Joel CoehoornDirector of Information TechnologyCommented:
Try this:

If e.Exception.GetType Is GetType(System.FormatException) Then...
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now