473,386 Members | 1,821 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,386 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 1190

"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

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...
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.