keyongtech


  keyongtech > dotnet.* > dotnet.general > 05/2008

 #1  
05-22-08, 04:02 PM
Phil Hunt
Is there a .NET #C equivalent of VB6 "On Error Resume Next".
 #2  
05-22-08, 05:00 PM
Tom Shelton
On 2008-05-22, Phil Hunt <aaa> wrote:
> 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 {}

....
 #3  
05-22-08, 05:14 PM
sloan
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/archi...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.







"Phil Hunt" <aaa> wrote in message
news:4772
 #4  
05-22-08, 05:55 PM
Tom Shelton
On 2008-05-22, sloan <sloan> wrote:
>
> 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.
 #5  
05-22-08, 06:45 PM
Phil Hunt
Well, there should be a way available to disable it no matter how good it
is.


"Tom Shelton" <tom_shelton> wrote in message
news:3500
[..]
 #6  
05-22-08, 07:01 PM
sloan
//quote
Well, there should be a way available to disable it no matter how good it
is.
//end quote


Huh?



"Phil Hunt" <aaa> wrote in message
news:3564
[..]
 #7  
05-22-08, 08:45 PM
Jon Skeet [C# MVP]
Phil Hunt <aaa> wrote:
> 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.
 #8  
05-22-08, 10:22 PM
Scott M.
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".


"Jon Skeet [C# MVP]" <skeet> wrote in message
news:2cd3
[..]
Similar Threads
VBA or VB.net equivalent of Equivalent of WordBasic WordBasic.SelectCurWord

I have a old wordbasic code that I am converting to VSTO what is equivalent of Word 97 (WordBasic) code WordBasic.SelectCurWord in VSTO Tried several...

Equivalent of GetPrivateProfileString equivalent in C#?

Does C# has an equivalent of the 'C' GetPrivateProfileString? or is the only way to get similar features to read from an INI file is to do a DllImport on Kernel32.dll? Thanks

a[i] not equivalent to *(a+i)?

Hello, I have a question regarding old good array and pointers. I remember reading a remark by Bjarne Stroustrup that a[i] is not equivalent to *(a+i) when it comes to...

MRU equivalent in .NET

Is there an equivalent implementation of CRecentFileList (MFC) in the .NET framework, or a sample of how to do this efficiently. Right now I am just using an array of...

Are these equivalent?

Are the following two statements equivalent? bitField = (bitField & (--bitField)); bitField = (bitField & (bitField-1)); Yes or no?


All times are GMT. The time now is 03:24 PM. | Privacy Policy