473,413 Members | 1,705 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,413 software developers and data experts.

Will this do the global error handling?

Hi

My vb.net winform app has frmMyForm as the start-up form. I have enclosed
My.Forms.frmMyForm.Show() within try/catch. Will this do the trick of
handling all exceptions that have not been handled elsewhere?

Thanks

Regards
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs) Handles
Me.Startup
Try
My.Forms.frmMyForm.Show()
Catch ex As Exception
' Exception handling here
End Try
End Sub
May 6 '07 #1
5 1675

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:OI****************@TK2MSFTNGP05.phx.gbl...
Hi

My vb.net winform app has frmMyForm as the start-up form. I have enclosed
My.Forms.frmMyForm.Show() within try/catch. Will this do the trick of
handling all exceptions that have not been handled elsewhere?

Thanks

Regards
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs) Handles
Me.Startup
Try
My.Forms.frmMyForm.Show()
Catch ex As Exception
' Exception handling here
End Try
End Sub
In terms of preventing the default exception handler from terminating your
app, I guess you could say it would work. In terms of providing a context
sensitive response to a given exception and giving your application a chance
to recover and continue, it's not going to be useful.
May 7 '07 #2
What can I do to improve?

Thanks

Regards

"pvdg42" <pv****@newsgroups.nospamwrote in message
news:uz**************@TK2MSFTNGP06.phx.gbl...
>
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:OI****************@TK2MSFTNGP05.phx.gbl...
>Hi

My vb.net winform app has frmMyForm as the start-up form. I have enclosed
My.Forms.frmMyForm.Show() within try/catch. Will this do the trick of
handling all exceptions that have not been handled elsewhere?

Thanks

Regards
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.Startup EventArgs) Handles
Me.Startup
Try
My.Forms.frmMyForm.Show()
Catch ex As Exception
' Exception handling here
End Try
End Sub
In terms of preventing the default exception handler from terminating your
app, I guess you could say it would work. In terms of providing a context
sensitive response to a given exception and giving your application a
chance to recover and continue, it's not going to be useful.


May 7 '07 #3
Hello John,

You need to guard against unhandled exceptions by registering a handler for
them.
Just add a ThreadExceptionEventHandler to the Application.ThreadException
delegate

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

JWhat can I do to improve?
J>
JThanks
J>
JRegards
J>
J"pvdg42" <pv****@newsgroups.nospamwrote in message
Jnews:uz**************@TK2MSFTNGP06.phx.gbl...
J>
>"John" <Jo**@nospam.infovis.co.ukwrote in message
news:OI****************@TK2MSFTNGP05.phx.gbl...
>>Hi

My vb.net winform app has frmMyForm as the start-up form. I have
enclosed My.Forms.frmMyForm.Show() within try/catch. Will this do
the trick of handling all exceptions that have not been handled
elsewhere?

Thanks

Regards

Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.Startu pEventArgs) Handles
Me.Startup
Try
My.Forms.frmMyForm.Show()
Catch ex As Exception
' Exception handling here
End Try
End Sub
In terms of preventing the default exception handler from terminating
your app, I guess you could say it would work. In terms of providing
a context sensitive response to a given exception and giving your
application a chance to recover and continue, it's not going to be
useful.

May 7 '07 #4
Hi Michael

Thanks. Is there an example somewhere I can look at as to how to do some
comprehensive exception handling with option to email log to the developer?

Many Thanks

Regards

"Michael Nemtsev" <ne*****@msn.comwrote in message
news:a2***************************@msnews.microsof t.com...
Hello John,

You need to guard against unhandled exceptions by registering a handler
for them.
Just add a ThreadExceptionEventHandler to the Application.ThreadException
delegate

---
WBR, Michael Nemtsev [.NET/C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

JWhat can I do to improve?
JJThanks
JJRegards
JJ"pvdg42" <pv****@newsgroups.nospamwrote in message
Jnews:uz**************@TK2MSFTNGP06.phx.gbl...
J>
>>"John" <Jo**@nospam.infovis.co.ukwrote in message
news:OI****************@TK2MSFTNGP05.phx.gbl.. .

Hi

My vb.net winform app has frmMyForm as the start-up form. I have
enclosed My.Forms.frmMyForm.Show() within try/catch. Will this do
the trick of handling all exceptions that have not been handled
elsewhere?

Thanks

Regards

Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.Start upEventArgs) Handles
Me.Startup
Try
My.Forms.frmMyForm.Show()
Catch ex As Exception
' Exception handling here
End Try
End Sub
In terms of preventing the default exception handler from terminating
your app, I guess you could say it would work. In terms of providing
a context sensitive response to a given exception and giving your
application a chance to recover and continue, it's not going to be
useful.


May 7 '07 #5
Hello John,

Smth like

AddHandler Application.ThreadException, _
New ThreadExceptionEventHandler( _
AddressOf Application_ThreadException)

at your main method, and handler

Private Shared Sub Application_ThreadException( _
ByVal sender As Object, _
ByVal e As System.Threading.ThreadExceptionEventArgs)
MessageBox.Show( _
"Send the following to support: " & _
e.Exception.ToString())
End Sub
To email log use System.Net.Mail http://weblogs.asp.net/scottgu/archi...10/432854.aspx
or 3rd party tools like log4net or Application Blogs,

btw, if your are in the web project u can use Health Monitoring features
http://msdn2.microsoft.com/en-us/library/ms178701.aspx

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

JHi Michael
J>
JThanks. Is there an example somewhere I can look at as to how to do
Jsome comprehensive exception handling with option to email log to the
Jdeveloper?
J>
JMany Thanks
J>
JRegards
J>
J"Michael Nemtsev" <ne*****@msn.comwrote in message
Jnews:a2***************************@msnews.microso ft.com...
J>
>Hello John,

You need to guard against unhandled exceptions by registering a
handler
for them.
Just add a ThreadExceptionEventHandler to the
Application.ThreadException
delegate
---
WBR, Michael Nemtsev [.NET/C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

JWhat can I do to improve?
JJThanks
JJRegards
JJ"pvdg42" <pv****@newsgroups.nospamwrote in message
Jnews:uz**************@TK2MSFTNGP06.phx.gbl...
J>
>>>"John" <Jo**@nospam.infovis.co.ukwrote in message
news:OI****************@TK2MSFTNGP05.phx.gbl. ..

Hi
>
My vb.net winform app has frmMyForm as the start-up form. I have
enclosed My.Forms.frmMyForm.Show() within try/catch. Will this do
the trick of handling all exceptions that have not been handled
elsewhere?
>
Thanks
>
Regards
>
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e
As
Microsoft.VisualBasic.ApplicationServices.Star tupEventArgs)
Handles
Me.Startup
Try
My.Forms.frmMyForm.Show()
Catch ex As Exception
' Exception handling here
End Try
End Sub
In terms of preventing the default exception handler from
terminating your app, I guess you could say it would work. In terms
of providing a context sensitive response to a given exception and
giving your application a chance to recover and continue, it's not
going to be useful.

May 7 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Evan Freeman[C++ Samuri] | last post by:
Ok I have recently run into an issue in our production environment, and am looking for solutions to error handling. Inside the Global.asa file I use the object tags to create an application...
17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
1
by: Kemal Taskin | last post by:
hi all, i have a question about asp.net's global error handling mechanisms. Using customErrors in web.config seems to be fine, it redirects you where you want. But how to display different...
7
by: Jonas | last post by:
Hi! I have an Application_Error method in global.asax that uses Server.Transfer to move execution to a custom error page. This works fine when an exception is thrown in one of the aspx or ascx...
5
by: OHM | last post by:
Hi everyone, I have a problem with error handling and wondered if anyone has managed to implement a global exception handling model. Is it possible to ensure that you see all exceptions before...
2
by: ===Steve L.=== | last post by:
does anyone know any site or ariticle provides exmaple for building a Global Error Handling Module in VB.Net? the module should be able to 1. prouduce friendly generic error msg for the users and...
4
by: Hardy Wang | last post by:
Hi all, In order to solve code-behind of global.asax problem, I removed the code from global.asax, and just leave one line "<%@ Application Language="C#" Inherits="Global"%>" in this file. Then I...
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...
1
by: John | last post by:
Hi I have a winform app with try/catch error handling implemented in key areas. Problem is errors can occur in other areas in situations that I may not foresee. Is there a way to implemented a...
5
by: John | last post by:
Hi My vb.net winform app has frmMyForm as the start-up form. I have enclosed My.Forms.frmMyForm.Show() within try/catch. Will this do the trick of handling all exceptions that have not been...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.