3 Module ExceptionHandlingA
\r
7 ' Finally block is executed regardless of how execution
\r
8 ' leaves the Try statement
\r
10 ' Case 1: through the end of Try block
\r
11 Dim i As Integer = 0
\r
19 Throw New Exception("#EHA1 - Finally block not executed")
\r
22 ' Case 2: through the end of Catch block
\r
25 Catch e As Exception
\r
32 Throw New Exception("#EHA2 - Finally block not executed")
\r
35 ' Case 3: through an Exit Try statement
\r
39 Catch e As Exception
\r
40 Console.WriteLine(e.Message)
\r
46 Throw New Exception("#EHA3 - Finally block not executed")
\r
49 ' Case 4: through a GoTo statement
\r
53 Catch e As Exception
\r
54 Console.WriteLine(e.Message)
\r
60 Throw New Exception("#EHA4 - Finally block not executed")
\r
63 ' Case 5: by not handling a thrown exception
\r
67 Throw New Exception("EE")
\r
71 Catch e As Exception
\r
76 Throw New Exception("#EHA5 - Finally block not exceuted")
\r