what is the point of 'Finally'



I've been looking at some code and started wondering what is the point of
'Finally" in Try Catch Finally.
Why not just place the Finally code after the End Try? Will the Catch fire
if there is an error in Finally?

Try
Dosomething()

Catch ex as Exception
messagebox.show(ex.message)

Finally
CompleteProcess()

End Try

---------------------------------

Try
Dosomething()

Catch ex as exception
messagebox.show(ex.message)

End Try

CompleteProcess()

----------------------------------

What's the difference?

Thanks,
m


.



Relevant Pages

  • Re: what is the point of Finally
    ... to execute regardless of whether or not the Try block completed ... > Dosomething() ... > Catch ex as Exception ... > CompleteProcess() ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Handling exceptions in functions
    ... returns false and raise the exception, ... procedure DoSomething(aParam: Integer); ... DoSomething(aParam2); ... So, for example, expected errors in a program may be ...
    (borland.public.delphi.non-technical)
  • Re: catch (...)
    ... "Tom Groszko" wrote in message ... > {dosomething(); ... > {report some error ... nice enough to base his exception class on std::exception you should be able ...
    (comp.lang.cpp)
  • Re: finalize()
    ... public void doSomething() throws Exception { ... File file = null; ... You failed to catch the Exception that doSomethingmight throw. ...
    (comp.lang.java.programmer)
  • Re: Is it possible for a try...finally...end construct to fail?
    ... :) try/finally and try/except are completely different ... side effect of Delphi's global exception handler). ... Probably show an error message to the user at this ...
    (borland.public.delphi.language.objectpascal)