473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1522
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: VM | last post by:
Is it possible to intercept all exception errors into one Try...Catch? I've tried wrapping Application.Run() in a Try...Catch, but it doesn't seem to work all the time. Thanks.
3
by: tafs7 | last post by:
My code below is supposed to email me when an error occurs on the application, but it's not emailing anything. Am I missing something? I know the smtp servers I've tried work. I even added a...
0
by: Mark | last post by:
There appear to be several ways to get the global error handler in global.asax.cs to fire repeatedly in a nasty endless loop. Is there a way to keep this event from firing only a handful of times...
6
by: fd123456 | last post by:
Er... Sorry to interrupt, but you CAN put methods and functions in the Global.asax file. You just have to make them static (Shared in VB). You can even use functions normally not available outside...
2
by: tshad | last post by:
I have my error handling set up in Global.asax: Sub Application_Error(Sender As Object, E as EventArgs) In this procedure I call a function in a dll that will write out to a history file. ...
0
by: hynek.cihlar | last post by:
A strange behaviour thatI found in ASP.NET 2.0. I am trying to issue a callback request (handled by ICallbackEventHandler and RaiseCallbackEvent) and a regular GET request in the client browser...
2
by: yeghia \(sosy\) | last post by:
Hi Guys I have two questions. 1. Is there a way to set a handler to .NET application so that in case of not caught exception my handler is called before application shutdown. I want to send an...
7
by: Jason Kester | last post by:
Best I can tell, there are three basic ways you can deal with global error handling in ASP.NET. Namely: 1. Derive all your pages from a custom Page class, and override OnError() 2. Specify a...
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.