In a try catch statement is a way to handle possible errors that may occur in a given block of code..
[ tryStatements ]
[ Catch [ exception [ As type ] ] [ When expression ]
[ catchStatements ] ]
[ Exit Try ]
[ Finally … Read More
Throw New Exception("Try")
Throw New Exception("Catch")
Catch ex As Exception
Console.WriteLine("Exception: " & ex.Message)
You get the following output:
This shows that the Finally block is executed in almost all circumstances (with a few exceptions discussed in the linked article). The given program starts by executing the Try block. Since it gives an exception, control is passed to the Catch block. Since the Catch block throws an exception, it will get handed to the next Try Catch block (if one exists) that can handle it. However, before that, the Finally block is executed.
It should be noted that the Finally block gets executed even if there is no exception, and if the Finally block throws an exception, it overrides the Try and Catch block's exceptions.