C# Vb On Error Resume Next
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business
Vb On Error Resume Next Example
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation vba on error resume next Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like vbscript on error resume next you, helping each other. Join them; it only takes a minute: Sign up What is the best alternative “On Error Resume Next” for C#? up vote 12 down vote favorite 2 If I put empty catch blocks
Sql On Error Resume Next
for my C# code, is it going to be an equivalent for VB.NET's "On Error Resume Next" statement. try { C# code; } catch(exception) { } The reason I am asking this is because I have to convert a VB.NET code to C#, and the old code has ~200 "On Error Resume Next" statements although I am using a proper try {} catch {} in my new code, but is there is a better alternative?
C# On Error Resume Next Equivalent
c# vb.net error-handling vb.net-to-c# share|improve this question edited Oct 25 '12 at 16:11 Peter Mortensen 10.2k1369107 asked Jan 28 '11 at 6:15 Neel 67121026 12 The lack of an alternative to On Error Resume Next wasn't just an unintentional oversight... Why do you possibly need this? If you explain the motivation behind your thoughts of doing this, I'm sure that someone here could give you a better solution. –Cody Gray Jan 28 '11 at 6:17 @Cody Gray - updated the reason of asking. Thanks –Neel Jan 28 '11 at 6:31 2 @MarkJ: Because even if (s)he leaves the code as VB.NET, it's still a good idea to replace On Error Goto Next with more structured exception handling (or none at all). –Cody Gray Jan 29 '11 at 2:04 4 @Cody It is an improvement to replace the error handling, but you have to assess how long it will take (how much it will cost) and whether the code needs substantial modifications. If the code works & doesn't need changing, there may be better things to do with the time instead. –MarkJ Jan 29 '11 at 14:21 1 @MarkJ: Fair enough. I don't disagree with you, I was just providing what I felt was a convincing argument for the other side. This is one of those design decisions yo
this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want http://www.vbforums.com/showthread.php?364099-What-s-the-equivalent-of-VB-On-Error-Resume-Next-in-C to visit from the selection below. Results 1 to 16 of 16 Thread: What's the equivalent of VB On Error Resume Next in C#? Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode http://forums.codeguru.com/showthread.php?398008-Alternative-for-quot-On-Error-Resume-Next-quot-in-VB-NEt Switch to Threaded Mode Oct 5th, 2005,09:30 AM #1 vincentg View Profile View Forum Posts Thread Starter Hyperactive Member Join Date Jun 2005 Location Chicago IL, USA Posts 261 What's the equivalent of VB On Error Resume Next in C#? on error What's the equivalent of VB On Error Resume Next in C#? Thanks.. Oct 5th, 2005,10:10 AM #2 wossname View Profile View Forum Posts Visit Homepage type Woss is new Grumpy; Join Date Aug 2002 Location #!/bin/bash Posts 5,683 Re: What's the equivalent of VB On Error Resume Next in C#? There isn't one, thankfully. I don't live here any more. Oct 5th, 2005,10:27 AM #3 vbPoet View Profile View Forum Posts Fanatic Member Join Date Feb 2005 Location Searching .. Posts 669 on error resume Re: What's the equivalent of VB On Error Resume Next in C#? You have to try and Catch statements. Oct 5th, 2005,10:37 AM #4 mendhak View Profile View Forum Posts Visit Homepage ASP.NET Moderator Join Date Feb 2002 Location Ulaan Baator GooGoo: Frog Posts 38,174 Re: What's the equivalent of VB On Error Resume Next in C#? Ah, the bane of Visual Basic programming. I hope not to see it soon. Mendhak.com|Flickr|Github|GPS Logger for Android| Oct 5th, 2005,10:41 AM #5 GlenW View Profile View Forum Posts Hyperactive Member Join Date Nov 2001 Location Gateshead, England Posts 479 Re: What's the equivalent of VB On Error Resume Next in C#? Originally Posted by vincentg What's the equivalent of VB On Error Resume Next in C#? Good coding! Oct 5th, 2005,10:43 AM #6 wossname View Profile View Forum Posts Visit Homepage type Woss is new Grumpy; Join Date Aug 2002 Location #!/bin/bash Posts 5,683 Re: What's the equivalent of VB On Error Resume Next in C#? No, good code is the opposite of resume next I don't live here any more. Oct 5th, 2005,10:45 AM #7 GlenW View Profile View Forum Posts Hyperactive Member Join Date Nov 2001 Location Gateshead, England Posts 479 Re: What's the equivalent of VB On Error Resume Next in C#? Originally Posted by wossname No, good code is the opposite of resume next Sorry my mistake. Oct 6th, 2005,02:33 PM #8 deranged View Profile View Forum Posts Visit Homepage Lively Member
Forum Visual Basic Programming Visual Basic .NET Alternative for "On Error Resume Next" in VB.NEt If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register or Login before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 14 of 14 Thread: Alternative for "On Error Resume Next" in VB.NEt Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode August 23rd, 2006,07:03 AM #1 rahulvasanth View Profile View Forum Posts Member Join Date Sep 2004 Posts 265 Alternative for "On Error Resume Next" in VB.NEt Hi I was using "On Error Resume Next" in VB to avoid certain errors. I want to know the equivalent of "On Error Resume Next" in VB.Net. Thanking in advance Reply With Quote August 23rd, 2006,07:30 AM #2 Kevin McFarlane View Profile View Forum Posts Member Join Date Jun 1999 Posts 153 Re: Alternative for "On Error Resume Next" in VB.NEt There isn't any. Kevin Reply With Quote August 23rd, 2006,07:35 AM #3 HanneSThEGreaT View Profile View Forum Posts CG Bouncer Power Poster Join Date Jul 2001 Location Sunny South Africa Posts 11,223 Re: Alternative for "On Error Resume Next" in VB.NEt Try and Catch blocks would be the more prefferred and appropriate way of Error handling Rahul. have a look at these FAQ's, Exception Handling is covered there as well : http://www.codeguru.com/forum/showthread.php?t=368148 More specifically, here's the link to the Exception Handling FAQ : http://www.codeguru.com/forum/showthread.php?t=383057 Hope it helps! All my Articles Hannes Reply With Quote August 23rd, 2006,07:37 AM #4 rahulvasanth View Profile View Forum Posts Member J