Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. On error goto....

On error goto....

Scheduled Pinned Locked Moved The Lounge
csharphelp
27 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paddy Boyd
    wrote on last edited by
    #1

    You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

    P P V P B 6 Replies Last reply
    0
    • P Paddy Boyd

      You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

      P Offline
      P Offline
      phannon86
      wrote on last edited by
      #2

      Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:

      He who makes a beast out of himself gets rid of the pain of being a man

      M V N 3 Replies Last reply
      0
      • P Paddy Boyd

        You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        As an exclusively C# shop, I know it's going to be a bad morning if I open up any code and find VB in it. (I'm not kicking VB here - just saying that I shouldn't find any).

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        P 1 Reply Last reply
        0
        • P Paddy Boyd

          You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          Why would one like to spoil the day and the bright cheerful morning by looking at a mourning sick and sluggish code like VB?

          Vasudevan Deepak Kumar Personal Homepage
          Tech Gossips
          A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

          P 1 Reply Last reply
          0
          • P Pete OHanlon

            As an exclusively C# shop, I know it's going to be a bad morning if I open up any code and find VB in it. (I'm not kicking VB here - just saying that I shouldn't find any).

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            P Offline
            P Offline
            Paddy Boyd
            wrote on last edited by
            #5

            Mmm. I fear it's not the language that's the problem here though...

            1 Reply Last reply
            0
            • V Vasudevan Deepak Kumar

              Why would one like to spoil the day and the bright cheerful morning by looking at a mourning sick and sluggish code like VB?

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

              P Offline
              P Offline
              Paddy Boyd
              wrote on last edited by
              #6

              It's not so much 'like' as 'have to'.

              1 Reply Last reply
              0
              • P Paddy Boyd

                You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

                P Offline
                P Offline
                peterchen
                wrote on last edited by
                #7

                After all, it could also have been ON ERROR RESUME NEXT

                We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                P 1 Reply Last reply
                0
                • P phannon86

                  Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:

                  He who makes a beast out of himself gets rid of the pain of being a man

                  M Offline
                  M Offline
                  Mike Dimmick
                  wrote on last edited by
                  #8

                  Phannon wrote:

                  At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks.

                  Stupid ivory-tower taboos. A goto statement can be helpful. But you should never use it where a structured control statement would be more appropriate. For some interesting reading see Gotos Considered Harmful and Other Programmers' Taboos[^].

                  DoEvents: Generating unexpected recursion since 1991

                  C B 2 Replies Last reply
                  0
                  • P peterchen

                    After all, it could also have been ON ERROR RESUME NEXT

                    We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                    blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                    P Offline
                    P Offline
                    Paddy Boyd
                    wrote on last edited by
                    #9

                    :) very true. I shall be thankful for small mercies.

                    1 Reply Last reply
                    0
                    • P phannon86

                      Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:

                      He who makes a beast out of himself gets rid of the pain of being a man

                      V Offline
                      V Offline
                      V 0
                      wrote on last edited by
                      #10

                      use goto, continue or break, you fail (break only allowed in switch statements.) use more then one exit in your function, you fail. and the prof was right... :)

                      V.
                      Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                      B J A 3 Replies Last reply
                      0
                      • M Mike Dimmick

                        Phannon wrote:

                        At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks.

                        Stupid ivory-tower taboos. A goto statement can be helpful. But you should never use it where a structured control statement would be more appropriate. For some interesting reading see Gotos Considered Harmful and Other Programmers' Taboos[^].

                        DoEvents: Generating unexpected recursion since 1991

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #11

                        I fully agree with you. :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                        1 Reply Last reply
                        0
                        • M Mike Dimmick

                          Phannon wrote:

                          At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks.

                          Stupid ivory-tower taboos. A goto statement can be helpful. But you should never use it where a structured control statement would be more appropriate. For some interesting reading see Gotos Considered Harmful and Other Programmers' Taboos[^].

                          DoEvents: Generating unexpected recursion since 1991

                          B Offline
                          B Offline
                          Brady Kelly
                          wrote on last edited by
                          #12

                          Mike Dimmick wrote:

                          Stupid ivory-tower taboos.

                          Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.

                          D B 2 Replies Last reply
                          0
                          • P Paddy Boyd

                            You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

                            B Offline
                            B Offline
                            Brady Kelly
                            wrote on last edited by
                            #13

                            Paddy Boyd wrote:

                            Stupid ivory-tower taboos.

                            I almost worked on a POS, also littered with those, but with the added qualifications, such as If Err.Number = nnn Then Resume Next Trying to find an error causing line was hell, because with Break on All Errors turned on, nearly every line caused an error, which was handled by code such as the above. Things like invalid array indexes, empty strings etc. that could all have been ignored with a proper code check, such as If i > UpperBound Then DoNothing, but no, it was just Write strData(i) and let the f****ing error handler see if the error was important.

                            1 Reply Last reply
                            0
                            • B Brady Kelly

                              Mike Dimmick wrote:

                              Stupid ivory-tower taboos.

                              Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.

                              D Offline
                              D Offline
                              David Stone
                              wrote on last edited by
                              #14

                              Agreed! On Error Resume Next, to me, always seems like saying "Eh. Who cares about what we're doing. The user should notice that half their data failed to get through our routine and fix it themselves..."

                              1 Reply Last reply
                              0
                              • P Paddy Boyd

                                You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...

                                M Offline
                                M Offline
                                Mike Dimmick
                                wrote on last edited by
                                #15

                                It's the only way of handling exceptions in VB6. VB6 also wouldn't give you a call stack so you basically had to do it yourself by putting On Error Goto in every function. Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy. If it was written new in VB.NET, not a translation from VB6, then the programmer should be shotretrained.

                                DoEvents: Generating unexpected recursion since 1991

                                P B 2 Replies Last reply
                                0
                                • M Mike Dimmick

                                  It's the only way of handling exceptions in VB6. VB6 also wouldn't give you a call stack so you basically had to do it yourself by putting On Error Goto in every function. Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy. If it was written new in VB.NET, not a translation from VB6, then the programmer should be shotretrained.

                                  DoEvents: Generating unexpected recursion since 1991

                                  P Offline
                                  P Offline
                                  Paddy Boyd
                                  wrote on last edited by
                                  #16

                                  I know. And i believe, written from scratch...

                                  1 Reply Last reply
                                  0
                                  • P phannon86

                                    Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:

                                    He who makes a beast out of himself gets rid of the pain of being a man

                                    N Offline
                                    N Offline
                                    NormDroid
                                    wrote on last edited by
                                    #17

                                    You'll find goto used in Microsoft code especially in cleanup functions.

                                    There is no Ctrl button on Chuck Norris's computer. Chuck Norris is always in control

                                    1 Reply Last reply
                                    0
                                    • V V 0

                                      use goto, continue or break, you fail (break only allowed in switch statements.) use more then one exit in your function, you fail. and the prof was right... :)

                                      V.
                                      Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                                      B Offline
                                      B Offline
                                      Brady Kelly
                                      wrote on last edited by
                                      #18

                                      I often use continue. It greatly improves readability.

                                      1 Reply Last reply
                                      0
                                      • M Mike Dimmick

                                        It's the only way of handling exceptions in VB6. VB6 also wouldn't give you a call stack so you basically had to do it yourself by putting On Error Goto in every function. Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy. If it was written new in VB.NET, not a translation from VB6, then the programmer should be shotretrained.

                                        DoEvents: Generating unexpected recursion since 1991

                                        B Offline
                                        B Offline
                                        Brady Kelly
                                        wrote on last edited by
                                        #19

                                        Mike Dimmick wrote:

                                        Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy.

                                        Or if it was, but with every (now) method being neatly wrapped up in a 'try' 'catch (Exception ex)' 'throw new Exception("Error!", ex);'

                                        1 Reply Last reply
                                        0
                                        • B Brady Kelly

                                          Mike Dimmick wrote:

                                          Stupid ivory-tower taboos.

                                          Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.

                                          B Offline
                                          B Offline
                                          BadKarma
                                          wrote on last edited by
                                          #20

                                          Brady Kelly wrote:

                                          Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.

                                          True, but that should also apply to the try/catch/do-nothings.

                                          codito ergo sum

                                          B 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups