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. I hoped that had died...

I hoped that had died...

Scheduled Pinned Locked Moved The Lounge
16 Posts 12 Posters 1 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.
  • OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #1

    ...just answered a VB .NET question in QA, and the first line of his method is...

    On Error Resume Next

    I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    R Kornfeld Eliyahu PeterK N S Sander RosselS 10 Replies Last reply
    0
    • OriginalGriffO OriginalGriff

      ...just answered a VB .NET question in QA, and the first line of his method is...

      On Error Resume Next

      I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu Peter
      wrote on last edited by
      #2

      Please! Never ever spoke to me again! Filthy VB lover... :laugh:

      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        ...just answered a VB .NET question in QA, and the first line of his method is...

        On Error Resume Next

        I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

        R Offline
        R Offline
        RossMW
        wrote on last edited by
        #3

        Didn't think you acknowledged vb :laugh:

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          ...just answered a VB .NET question in QA, and the first line of his method is...

          On Error Resume Next

          I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

          N Offline
          N Offline
          Nagy Vilmos
          wrote on last edited by
          #4

          It is disgusting, just like

          try {
          // 8,000 lines of nested crap
          } catch (Exception ex) { }

          veni bibi saltavi

          OriginalGriffO 1 Reply Last reply
          0
          • N Nagy Vilmos

            It is disgusting, just like

            try {
            // 8,000 lines of nested crap
            } catch (Exception ex) { }

            veni bibi saltavi

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            It's worse than that! It's like:

            try {
            // A single line of code
            } catch (Exception ex) { }
            try {
            // A single line of code
            } catch (Exception ex) { }
            try {
            // A single line of code
            } catch (Exception ex) { }
            try {
            // A single line of code
            } catch (Exception ex) { }
            try {
            // A single line of code
            } catch (Exception ex) { }
            try {
            // A single line of code
            } catch (Exception ex) { }
            try {
            // A single line of code
            } catch (Exception ex) { }
            ... repeated 8000 times...

            X|

            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            N 1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              It's worse than that! It's like:

              try {
              // A single line of code
              } catch (Exception ex) { }
              try {
              // A single line of code
              } catch (Exception ex) { }
              try {
              // A single line of code
              } catch (Exception ex) { }
              try {
              // A single line of code
              } catch (Exception ex) { }
              try {
              // A single line of code
              } catch (Exception ex) { }
              try {
              // A single line of code
              } catch (Exception ex) { }
              try {
              // A single line of code
              } catch (Exception ex) { }
              ... repeated 8000 times...

              X|

              Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

              N Offline
              N Offline
              Nagy Vilmos
              wrote on last edited by
              #6

              I once saw:

              On Error Goto ErrorHandler
              ' 8,000 lines of really bad VB
              ErrorHandler:
              MsgBox err 'can't remember format
              resume 'yup, goes back to the line what errored!

              veni bibi saltavi

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                ...just answered a VB .NET question in QA, and the first line of his method is...

                On Error Resume Next

                I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                S Offline
                S Offline
                Sinisa Hajnal
                wrote on last edited by
                #7

                I saw it and my first advice was to remove it. Then to improve the code :p Unfortunately, no, its not dead, there are still VB6 programmers - I'm currently working on a project that was written by VB6 turned VB.NET programmer and I'm still refactoring whenever I get the chance. I have DAL interface with all data access methods defined in there...and I don't have time to split it so I continue adding to it when changing existing code. It is at 300+ methods right now. With two concrete classes implementing it. X|

                1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  ...just answered a VB .NET question in QA, and the first line of his method is...

                  On Error Resume Next

                  I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #8

                  I know an old VB dinosaur who does it almost right...

                  Try
                  ' Code... Mostly like:
                  Dim sCode As String = 123 ' Yes, this is possible with Option Strict Off (the default).
                  Dim Id As Integer ' From hungarian to PascalCase...
                  Dim someOtherVar As String ' And then correct camelCast, all in one method.
                  Catch (ex As Excpetion)
                  Log(Err.Message) ' Err, because why use ex?
                  End Try

                  I used to see this pre-.NET VB mixed with VB.NET a lot :rolleyes:

                  Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.

                  Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                  Regards, Sander

                  1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    ...just answered a VB .NET question in QA, and the first line of his method is...

                    On Error Resume Next

                    I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                    K Offline
                    K Offline
                    Kenneth Haugland
                    wrote on last edited by
                    #9

                    Ah, you would love Rx then, there is something called Retry there :D Click and cry[^]

                    OriginalGriffO 1 Reply Last reply
                    0
                    • K Kenneth Haugland

                      Ah, you would love Rx then, there is something called Retry there :D Click and cry[^]

                      OriginalGriffO Offline
                      OriginalGriffO Offline
                      OriginalGriff
                      wrote on last edited by
                      #10

                      Retry actually makes sense: sometimes you have to wait for something to "wake up" so doing it three times before failing isn't a bad idea. Be a nice addon to C#:

                      retry (3)
                      {
                      MyOperation();
                      }
                      catch (Exception ex)
                      {
                      ...
                      }

                      Or even just

                      try (3)
                      {
                      MyOperation();
                      }
                      catch (Exception ex)
                      {
                      ...
                      }

                      Mind you, it'd also be nice to have try with a timespan timeout which caused a catch sometimes.

                      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                      K 1 Reply Last reply
                      0
                      • OriginalGriffO OriginalGriff

                        Retry actually makes sense: sometimes you have to wait for something to "wake up" so doing it three times before failing isn't a bad idea. Be a nice addon to C#:

                        retry (3)
                        {
                        MyOperation();
                        }
                        catch (Exception ex)
                        {
                        ...
                        }

                        Or even just

                        try (3)
                        {
                        MyOperation();
                        }
                        catch (Exception ex)
                        {
                        ...
                        }

                        Mind you, it'd also be nice to have try with a timespan timeout which caused a catch sometimes.

                        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                        K Offline
                        K Offline
                        Kenneth Haugland
                        wrote on last edited by
                        #11

                        I think you can with Rx, but It will involve some nasty code. If you look in the link I posted you can retry infinitely many times:

                        public static void RetrySample<T>(IObservable<T> source)
                        {
                        source.Retry().Subscribe(t=>Console.WriteLine(t)); //Will always retry
                        Console.ReadKey();
                        }

                        So all you have to do is to enclose the subscription in an Observer, and set a timerinterval for desubscription by using an IObserver class.

                        1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          ...just answered a VB .NET question in QA, and the first line of his method is...

                          On Error Resume Next

                          I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                          Z Offline
                          Z Offline
                          ZurdoDev
                          wrote on last edited by
                          #12

                          OriginalGriff wrote:

                          Why isn't this abortion dead?

                          When you have a function that calls an external process and you don't care if it generates an error or not, then it works great. If it does generate an error it's an external process and nothing you can do about it and you still want the rest of your code to run.

                          There are only 10 types of people in the world, those who understand binary and those who don't.

                          1 Reply Last reply
                          0
                          • OriginalGriffO OriginalGriff

                            ...just answered a VB .NET question in QA, and the first line of his method is...

                            On Error Resume Next

                            I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                            Richard DeemingR Offline
                            Richard DeemingR Offline
                            Richard Deeming
                            wrote on last edited by
                            #13

                            There was a "question" back in April which was basically a rant about how C# sucked because it didn't have this "feature". The OP was insistent that his code was perfect, and he just wanted to ignore Microsoft's errors. :doh:


                            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                            G 1 Reply Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              ...just answered a VB .NET question in QA, and the first line of his method is...

                              On Error Resume Next

                              I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                              Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                              J Offline
                              J Offline
                              James McCullough
                              wrote on last edited by
                              #14

                              The worst part of this is that I find a whole bunch of vendors that do this crap, too! I deal with Dynamics GP, where customizations can be written in VBA. I had a major error in one window where it kept dumping the user into VBA, bypassing all security. I contacted the vendor, and (sort of politely) requested they get their **** together. They sent me updated code... First line?

                              On error resume next

                              I lost it! They were confused why we changed vendors within a week after that...

                              1 Reply Last reply
                              0
                              • Richard DeemingR Richard Deeming

                                There was a "question" back in April which was basically a rant about how C# sucked because it didn't have this "feature". The OP was insistent that his code was perfect, and he just wanted to ignore Microsoft's errors. :doh:


                                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                G Offline
                                G Offline
                                Gary Wheeler
                                wrote on last edited by
                                #15

                                Richard Deeming wrote:

                                The OP was insistent that his code was perfect, and he just wanted to ignore Microsoft's errors.

                                You know, sometimes natural selection is just too damned slow.

                                Software Zen: delete this;

                                1 Reply Last reply
                                0
                                • OriginalGriffO OriginalGriff

                                  ...just answered a VB .NET question in QA, and the first line of his method is...

                                  On Error Resume Next

                                  I feel dirty for just having typed it. X| Why isn't this abortion dead? Who is teaching people about this? And why? If you see anyone recommending it, can you please, please, give them a swift kick where it really hurts?

                                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                                  M Offline
                                  M Offline
                                  Mark_Wallace
                                  wrote on last edited by
                                  #16

                                  I used it once, in a mini-prog that just creates empty, numbered ZIP or RAR files. The code was so simple that any potential "real" errors were dealt with without hardly having to think about them, so the only thing to worry about was if someone tried to create files with the same filenames as existing file (which I'd set to fail). It simply wasn't worth the effort of catching the error, so I just let it happen and Resumed Next.

                                  I wanna be a eunuchs developer! Pass me a bread knife!

                                  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