PDA

View Full Version : try-catch-finally block


handshakeit
05-11-2006, 09:40 AM
Hello all

I Know that in try-catch-finally block the code inside the finally block is always executed whether there is exception or not.
my question is what will happen if we terminate the application in last statement of try block n suppose there is no exception in try block and also there is some code in finally block.......
What will happen???

Nischumacher
05-11-2006, 12:19 PM
i THiNK THe FiNaLLY BLoCK WiLL Be eXeCuTeD.
BeCauSe aPPLiCaTioN.eXiT SToPS aLL MeSSaGe LooPS, THReaDS, aND CLoSeS aLL THe WiNDoWS AFTER THe MeSSaGeS HaVe BeeN PRoCeSSeD.

handshakeit
05-11-2006, 01:01 PM
I hav just tried it
if we use
Application.Exit();
in try block it even doesn't execute next statement to it in block
and doesn't go to the finally block

Can u Expalin it ??

Malith
05-18-2006, 01:02 PM
this problem comes database connection.

in this situation we must consider the abort part. when i send some data to the database at that time i close the application u must add the coding commit or abort part.

some times its work finally.

cheers

malith