How to tell the type of exception

C

Chris

I have a custom exception which gets thrown in my business layer. I catch it
in the item inserted event of my formview. How do I tell whether it is a
custom error or another type of error. Is there a way of saying is
"e.exception of type custom error". Regards, Chris.
 
C

Chris

Is it as simple as

If TypeOf obj Is TextBox Then...

I've logged off from my development machine and can't get access right now.
 
B

Brandon Gano

If you need to handle different exceptions in different ways, you should use
multiple catch blocks (sorry for the C#):

try
{
// ...
}
catch (MyException e)
{
// handle my exceptions
}
catch (Exception e)
{
// handle all other exceptions
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top