469,934 Members | 2,338 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Global error handler

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
Feb 16 '07 #1
3 1383
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.
-----------------------------------------------
"Rodrigo Juarez" <ti**************@newsgroup.nospamwrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
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

Feb 16 '07 #2
Yes! this is what I looking for

"RobinS" <Ro****@NoSpam.yah.noneescribió en el mensaje
news:R6******************************@comcast.com. ..
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.
-----------------------------------------------
"Rodrigo Juarez" <ti**************@newsgroup.nospamwrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
>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


Feb 16 '07 #3
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mark | last post: by
6 posts views Thread by fd123456 | last post: by
2 posts views Thread by tshad | last post: by
reply views Thread by hynek.cihlar | last post: by
2 posts views Thread by yeghia \(sosy\) | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.