Rigga
Thu Jul 01 04:47:48 CDT 2004
Hi Jay,
Thanks for both your posts, I think a change to the way the App start's is
required.
Again, thanks for your input. Much appreciated.
R.
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message
news:uhwvolrXEHA.1000@TK2MSFTNGP12.phx.gbl...
> Rigga,
> Depending on the type of application you are creating, .NET has three
> different global exception handlers.
>
> For ASP.NET look at:
> System.Web.HttpApplication.Error event
> Normally placed in your Global.asax file.
>
> For console applications look at:
> System.AppDomain.UnhandledException event
> Use AddHandler in your Sub Main.
>
> For Windows Forms look at:
> System.Windows.Forms.Application.ThreadException event
> Use AddHandler in your Sub Main.
>
> It can be beneficial to combine the above global handlers in your app, as
> well as wrap your Sub Main in a try catch itself.
>
> There is an article in the June 2004 MSDN Magazine that shows how to
> implement the global exception handling in .NET that explains why & when
you
> use multiple of the above handlers...
>
>
http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx
>
> For example: In my Windows Forms apps I would have a handler attached to
the
> Application.ThreadException event, plus a Try/Catch in my Main. The
> Try/Catch in Main only catches exceptions if the constructor of the
MainForm
> raises an exception, the Application.ThreadException handler will catch
all
> uncaught exceptions from any form/control event handlers.
>
> Hope this helps
> Jay
>
>
> "Rigga" <s@v.c> wrote in message
> news:JnwEc.950$Fc7.219775@stones.force9.net...
> > Hi all,
> >
> > I am trying to catch the exceptions from a VB.NET app.
> >
> > I use a startup project, so that i can show the MDI main application
> window
> > as a dialog within a Try Catch block. se below..
> >
> > Try
> >
> > Dim f as MainForm
> > f.ShowDialog()
> >
> > Catch ex as Exception
> > ' write nice error reporting routine!
> > End Try
> >
> > Then in the Catch ex as Exception.. I write a nice error file..
> >
> > This all works fine when i run the App from within the IDE, but when i
run
> > outside of the IDE i.e. run the .exe file. it doesn't seem to catch the
> > exception???
> >
> > It brings up a dialog box, with the error details, and allows the user
to
> > hit the continue button and carry on as if nothing happened!?
> >
> > Anyone else had this problem? or am i just doing something wrong?
> >
> > Thanks in Advance.
> > R.
> >
> >
>
>