VB6 Equivalent

  • Thread starter Thread starter Phil Hunt
  • Start date Start date
Is there a .NET #C equivalent of VB6 "On Error Resume Next".

Not really, the closest would be that you would have to enclose every
line in a try catch statement...

try
{
// one line of code
}
catch {}

try
{
// next line of code
}
catch {}

....
 
The #1 thing you can do with a VB6 mentality of exception handling in DotNet
is

1. Put it in a brown paper bag.
2. Take it to someone's house you don't like.
3. Set it on fire.
4. Run away from it as fast as you can.


...

I'm not trying to be mean, but rather FIRM about it.

Check here:
http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx


If you're using "resume next" in your VB.NET code, then stop doing it. Just
because you ~can~ doesn't mean you ~should~.

...

Good luck.
 
The #1 thing you can do with a VB6 mentality of exception handling in DotNet
is

1. Put it in a brown paper bag.
2. Take it to someone's house you don't like.
3. Set it on fire.
4. Run away from it as fast as you can.


..

LOL... So true.
 
//quote
Well, there should be a way available to disable it no matter how good it
is.
//end quote


Huh?
 
Phil Hunt said:
Well, there should be a way available to disable it no matter how good it
is.

What, exception handling? No, not really. Exceptions are thrown for a
purpose. The closest you can come to ignoring them is to explicitly put
a try/catch block around each statement. This is really painful, for a
very good reason - if something goes wrong, you almost *never* just
want to ignore it and carry on with the very next statement.
 
Agreed. I always thought of On Error Resume Next as "Close your eyes and
cover your ears and pretend everything is ok, when it isn't".
 
Back
Top