Dean,
In addition to Tom's comments.
Depending on the type of application you are creating, .NET has three
different global exception handlers.
For ASP.NET look at:
System.Web.Http Application.Err or event
Normally placed in your Global.asax file.
For console applications look at:
System.AppDomai n.UnhandledExce ption event
Use AddHandler in your Sub Main.
For Windows Forms look at:
System.Windows. Forms.Applicati on.ThreadExcept ion 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/is...T/default.aspx
For example: In my Windows Forms apps I would have a handler attached to the
Application.Thr eadException 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.Thr eadException handler will catch all
uncaught exceptions from any form/control event handlers.
In your example: for my Windows Console application I would only handle the
AppDomain.Unhan dledException event, possible using the Console API to query
the user, and send the results. For a Windows Forms application I would
handle at least the Application.Thr eadException and possible the
AppDomain.Unhan dledException (based on the info in the above link) using a
Windows Form to query the user and send the results. For a Windows Service I
would not query the user, instead simply logging & sending the info...
Because the event handlers are local to the application they would know what
type of application it is...
In either case I would log the information also, in case physically sending
is not an option.
Hope this helps
Jay
"Dean Slindee" <sl*****@charte r.net> wrote in message
news:10******** *****@corp.supe rnews.com...
I have a exception handling class that could be called from either a
windows project app or a console project app. Is there any way for this class to
determine which type of app called it without sending an window/console
parameter from either app?
Thanks,
Dean Slindee