Wednesday, May 09, 2007

Try Catch and Finally, yes make use of the Finally!

The "Finally" in the Try Catch statement is a great place to close your connection.

Public Sub TestFunction()
Try
Return
Catch ex As Exception
Finally
Console.WriteLine("TestFunction finally called!")
Throw New Exception("Error!")
End Try
End Sub

regards,
choongseng

No comments: