Global error handler

R

Rodrigo Juarez

Hi

Microsoft Visual Studio 2005, Visual Basic and winforms application
I need a global error handler, where should I put that.
Any examples?

TIA

Rodrigo Juarez
 
R

RobinS

Rodrigo,

I'm not sure what you mean by global error handler. If you want to put one
in that will catch any error not captured by a *local* Try/Catch structure,
you can put one in ApplicationEvents.

Exceptions bubble up the call tree until they are handled (or they hit the
top and blow up). The top of the tree is in ApplicationEvents, where you
can add an event handler for unhandled exceptions.

To get to the ApplicationEvents, double-click on "My Projects" to bring up
project properties, then select the tab "Application", and click on the
button "View Application Events".

To see what events you can capture, pull down the left dropdown at the top
and select "(MyApplication Events)". Then pull down the right dropdown at
the top. The one you want is UnhandledException.

There are also events for the application starting up and shutting down,
etc.

Is this what you're looking for?

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
 
R

Rodrigo Juarez

Yes! this is what I looking for

RobinS said:
Rodrigo,

I'm not sure what you mean by global error handler. If you want to put one
in that will catch any error not captured by a *local* Try/Catch
structure, you can put one in ApplicationEvents.

Exceptions bubble up the call tree until they are handled (or they hit the
top and blow up). The top of the tree is in ApplicationEvents, where you
can add an event handler for unhandled exceptions.

To get to the ApplicationEvents, double-click on "My Projects" to bring up
project properties, then select the tab "Application", and click on the
button "View Application Events".

To see what events you can capture, pull down the left dropdown at the top
and select "(MyApplication Events)". Then pull down the right dropdown at
the top. The one you want is UnhandledException.

There are also events for the application starting up and shutting down,
etc.

Is this what you're looking for?

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
 
J

Jeffrey Tan[MSFT]

Hi Rodrigo,

Glad to see your problem is resolved. Below is some more information:

Actually, VB2005 UnhandledException encapsulates .Net Winform
Application.ThreadException. .Net provided 3 different types of global
error handler for unhandled exceptions based on the application types.

..Net Winform -- Application.ThreadException event
..Net Console -- AppDomain.UnhandledException event
Asp.net -- HttpApplication.Error event, which is defined in Global.asax as
Application_Error method.

Please refer to the article below:
"Unexpected Errors in Managed Applications"
http://msdn.microsoft.com/msdnmag/issues/04/06/NET/

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top