i just want to know from you guys about the use of finally in Try Catch code????

Do you have a more specific question? I'm not keen on writing an exception handling tutorial.

Take a look at the MSDN article. And try this out:

Sub Main()
    Try
        Try
            Console.WriteLine("Try")
            Throw New Exception("Try")
        Catch
            Console.WriteLine("Catch")
            Throw New Exception("Catch")
        Finally
            Console.WriteLine("Finally")
        End Try
    Catch ex As Exception
        Console.WriteLine("Exception: " & ex.Message)
    End Try
    Console.ReadKey(True)
End Sub

You get the following output:

Try
Catch
Finally
Exception: Catch

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.

In a try catch statement is a way to handle possible errors that may occur in a given block of code..

example:

Try
   [ tryStatements ]
[ Catch [ exception [ As type ] ] [ When expression ] 
   [ catchStatements ] ]
[ Exit Try ]
...
[ Finally
   [ finallyStatements ] ]
End Try

thank you guys...!

commented: You're welcome! +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.