0

Guys,

A challenge for us... for you I mean lol! Can anyone of you have any idea on how to make an equivalent code of On Error Resume Next of VB to C#?.

Note: Don't use a try catch

Regards,

Jireh

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jireh
0

>Note: Don't use a try catch
Erm, why? On Error is generally considered to be a huge wart of VB, so why would you want to avoid the superior equivalent in C# and try to emulate it?

0

ok... you can use a try catch but what if i have 100 lines of code, you mean to say you have to try catch it in 100 times? or arrrgggghhhh! please see below sample.

private int Calculate(int x, int y)
{
     x=x+y;
     y=y-x;
     Calculate=x+y;
     return Calculate
}

My problem is we don't know what line will the error occur. suppose the error will be in x=x+y; so it will resume in y=y-x; or the error will be in y=y-x; and again it must resume in Calculate=x+y;
and please don't ask me why it must resume...Just help me to this issue please... that it must resume to next statement if there's an error...

regards,
Jireh

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.