cancel
Showing results for 
Search instead for 
Did you mean: 

Exception Handling with SDK and VB.Net

Former Member
0 Kudos

Hello,

I would like to know the correct exception handling with SDK using .Net, is there some articles - documentations?

Don't we need to catch particular exception?

Andrea

Accepted Solutions (1)

Accepted Solutions (1)

barend_morkel2
Active Contributor
0 Kudos

You don't need to catch a particular exception.

(it's not like Java...)

This normal try block works fine:

Try

'Your code

Catch ex As Exception

End Try

I normally begin each sub or function with a try and end with the catch. That is the "safe way" to do it.

You can also use :

Try

'Your code

'e.g create/instanciate an object

Finally

' free the object

End Try

to ensure that something gets done - no matter what, the finally block will always get run.

Another option is this:

Try

Try

Catch ex As Exception

End Try

Finally

End Try

Where you catch a possible exception and always finally do something.

Answers (0)