470,586 Members | 1,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

unhandled exception

Hi,
I made a handler for unhandled errors. But before that is executed, VB.NET
gives me the standard error window. In VB6 there was a setting
(errortrapping) about handling errors
in the design environment and classes, which should prevent the before
mentioned behaviour. Does VB.NET have a setting like it? Or is there
something else?

Thanks in advance
Frank

Nov 20 '05 #1
4 2233
If your talking about type of global error handler for a forms code, you
could try launching the form inside a try catch block.

OHM

"Frank" <fr***@frank.com> wrote in message
news:ca**********@news2.tilbu1.nb.home.nl...
Hi,
I made a handler for unhandled errors. But before that is executed, VB.NET gives me the standard error window. In VB6 there was a setting
(errortrapping) about handling errors
in the design environment and classes, which should prevent the before
mentioned behaviour. Does VB.NET have a setting like it? Or is there
something else?

Thanks in advance
Frank

Nov 20 '05 #2
* "Frank" <fr***@frank.com> scripsit:
I made a handler for unhandled errors. But before that is executed, VB.NET
gives me the standard error window. In VB6 there was a setting
(errortrapping) about handling errors
in the design environment and classes, which should prevent the before
mentioned behaviour. Does VB.NET have a setting like it? Or is there
something else?


How did you make this error handler? Did you add a handler to
'Application.ThreadException'?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Frank,
I made a handler for unhandled errors. But before that is executed, VB.NET gives me the standard error window. Where & how did you "made a handler for unhandled errors"?

Depending on the type of application you are creating, .NET has three
different global exception handlers.

For ASP.NET look at:
System.Web.HttpApplication.Error event
Normally placed in your Global.asax file.

For console applications look at:
System.AppDomain.UnhandledException event
Use AddHandler in your Sub Main.

For Windows Forms look at:
System.Windows.Forms.Application.ThreadException event
Use AddHandler in your Sub Main.

It can be beneficial to combine the above global handlers in your app, as
well as wrap your Sub Main in a try catch itself.

There is an article in the June 2004 MSDN Magazine that shows how to
implement the global exception handling in .NET that explains why & when you
use multiple of the above handlers...

http://msdn.microsoft.com/msdnmag/is...T/default.aspx

For example: In my Windows Forms apps I would have a handler attached to the
Application.ThreadException event, plus a Try/Catch in my Main. The
Try/Catch in Main only catches exceptions if the constructor of the MainForm
raises an exception, the Application.ThreadException handler will catch all
uncaught exceptions from any form/control event handlers.
gives me the standard error window. In VB6 there was a setting
(errortrapping) about handling errors
in the design environment and classes, which should prevent the before
mentioned behaviour. Does VB.NET have a setting like it? To have the IDE break on exceptions use "Debug - Exceptions" then select the
"Common Language Runtime Exceptions" node in the tree. Change either the
"When the exception is thrown" or "If the exception is not handled" option
as needed. If you have a global exception handler per above, you will need
to change the "When the exception is thrown" to "Break into the debugger",
as the global handlers is handling the exception!

Note you can expand the "Common Language Runtime Exceptions" tree to change
the settings for specific exceptions...

Hope this helps
Jay
"Frank" <fr***@frank.com> wrote in message
news:ca**********@news2.tilbu1.nb.home.nl... Hi,
I made a handler for unhandled errors. But before that is executed, VB.NET gives me the standard error window. In VB6 there was a setting
(errortrapping) about handling errors
in the design environment and classes, which should prevent the before
mentioned behaviour. Does VB.NET have a setting like it? Or is there
something else?

Thanks in advance
Frank

Nov 20 '05 #4
"Frank" <fr***@frank.com> wrote in message news:<ca**********@news2.tilbu1.nb.home.nl>...
Hi,
I made a handler for unhandled errors. But before that is executed, VB.NET
gives me the standard error window. In VB6 there was a setting
(errortrapping) about handling errors
in the design environment and classes, which should prevent the before
mentioned behaviour. Does VB.NET have a setting like it? Or is there
something else?

Thanks in advance
Frank


In the VS design environment, Click DEBUG menu and select EXCEPTIONS
from the sub menu. This allows you to define what action to take when
an exception is thrown and if it is not handled. You can define
actions for individual exceptions also. Great if you are trying to
track down a specific error in your app
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Chuck Hartman | last post: by
5 posts views Thread by Dave Stewart | last post: by
5 posts views Thread by Lucvdv | last post: by
reply views Thread by Colmeister | last post: by
5 posts views Thread by Simon Tamman {Uchiha Jax} | last post: by
5 posts views Thread by =?Utf-8?B?c3VydHVyeg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.