Try.. Catch....

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Neelam Karne (NeelamKarne_at_hotmail.com)
Date: 09/17/04


Date: Fri, 17 Sep 2004 11:01:25 -0700

I am using VB.Net with .Net Framework 1.1

Here is my code

Try

            'Try my statements

Catch

            'Catch my exception

            Exit Sub

Finally

            'Close my database connections...

What I noticed is when the program flow enters the Catch block, even though
there is an Exit Sub statement here, program still executes "Finally"
statement.

Here are my questions.

  1.. There is no effect of exit statement here. Finally will be always
called when finally block statement exist.
  2.. Finally block will be executed irrespective the catch block is
executed or not.
Is it correct? Any thoughts?

Neelam