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. Other Discussions
  3. The Weird and The Wonderful
  4. It won't take no for an answer

It won't take no for an answer

Scheduled Pinned Locked Moved The Weird and The Wonderful
11 Posts 9 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
    Pedro H Fialho
    wrote on last edited by
    #1

    Just found this:

        private void trySave(ref clsWord objWord, string strFullPath, Format format)
        {
            try
            {
                objWord.save(strFullPath, format);
            }
            catch (InvalidOperationException ex)
            {
                if (ex != null)
                {
                    trySave(ref objWord, strFullPath, format);
                }
            }
        }
    
    A L B V D 6 Replies Last reply
    0
    • P Pedro H Fialho

      Just found this:

          private void trySave(ref clsWord objWord, string strFullPath, Format format)
          {
              try
              {
                  objWord.save(strFullPath, format);
              }
              catch (InvalidOperationException ex)
              {
                  if (ex != null)
                  {
                      trySave(ref objWord, strFullPath, format);
                  }
              }
          }
      
      A Offline
      A Offline
      Andre Kraak
      wrote on last edited by
      #2

      Quote William Edward Hickson[^]:

      'Tis a lesson you should heed: Try, try, try again. If at first you don't succeed, Try, try, try again.

      OriginalGriffO 1 Reply Last reply
      0
      • A Andre Kraak

        Quote William Edward Hickson[^]:

        'Tis a lesson you should heed: Try, try, try again. If at first you don't succeed, Try, try, try again.

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

        Yeah, but your version stops after three goes... :laugh:

        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

        "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

        1 Reply Last reply
        0
        • P Pedro H Fialho

          Just found this:

              private void trySave(ref clsWord objWord, string strFullPath, Format format)
              {
                  try
                  {
                      objWord.save(strFullPath, format);
                  }
                  catch (InvalidOperationException ex)
                  {
                      if (ex != null)
                      {
                          trySave(ref objWord, strFullPath, format);
                      }
                  }
              }
          
          L Offline
          L Offline
          LynxEnvoy
          wrote on last edited by
          #4

          And what's that ex != null for? :laugh:

          P T 2 Replies Last reply
          0
          • P Pedro H Fialho

            Just found this:

                private void trySave(ref clsWord objWord, string strFullPath, Format format)
                {
                    try
                    {
                        objWord.save(strFullPath, format);
                    }
                    catch (InvalidOperationException ex)
                    {
                        if (ex != null)
                        {
                            trySave(ref objWord, strFullPath, format);
                        }
                    }
                }
            
            B Offline
            B Offline
            Bernhard Hiller
            wrote on last edited by
            #5

            Well, eventually it will, but detrimentously: the StackOverflowException won't be dealt with at this place.

            1 Reply Last reply
            0
            • L LynxEnvoy

              And what's that ex != null for? :laugh:

              P Offline
              P Offline
              Pedro H Fialho
              wrote on last edited by
              #6

              For a moment I thought about that, but then I just gave up trying.

              1 Reply Last reply
              0
              • L LynxEnvoy

                And what's that ex != null for? :laugh:

                T Offline
                T Offline
                thatraja
                wrote on last edited by
                #7

                I think he got NullReferenceException so added that condition to avoid the error

                thatraja

                Code converters | Education Needed No thanks, I am all stocked up. - Luc Pattyn When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute

                1 Reply Last reply
                0
                • P Pedro H Fialho

                  Just found this:

                      private void trySave(ref clsWord objWord, string strFullPath, Format format)
                      {
                          try
                          {
                              objWord.save(strFullPath, format);
                          }
                          catch (InvalidOperationException ex)
                          {
                              if (ex != null)
                              {
                                  trySave(ref objWord, strFullPath, format);
                              }
                          }
                      }
                  
                  V Offline
                  V Offline
                  Vladimir Svyatski
                  wrote on last edited by
                  #8

                  The code is complete bullshit!

                  • What is the point of using ref? objWord is not assigned any value. I guess, the author has never heard of reference types and value types, doesn't differentiate them and also is a former C++ developer.

                  • If an exception is generated, a variable, representing it, can NEVER be null. And the check

                    ex != null

                    just looks stupid.

                  • Also, it will sound very upsetting for the author, but if the exception mentioned above is ever generated, he is about to face an infinite recursion, hence he will also face the full power of the StackOverflowException.

                  Summarizing the above, I'd say he better work in McDonald's. To get a chance to become a manager :rolleyes:, that is a real chance to afford Ford Mustang GT... someday :-\ .

                  lifecycle of a lifecycle of a lifecycle

                  P 1 Reply Last reply
                  0
                  • V Vladimir Svyatski

                    The code is complete bullshit!

                    • What is the point of using ref? objWord is not assigned any value. I guess, the author has never heard of reference types and value types, doesn't differentiate them and also is a former C++ developer.

                    • If an exception is generated, a variable, representing it, can NEVER be null. And the check

                      ex != null

                      just looks stupid.

                    • Also, it will sound very upsetting for the author, but if the exception mentioned above is ever generated, he is about to face an infinite recursion, hence he will also face the full power of the StackOverflowException.

                    Summarizing the above, I'd say he better work in McDonald's. To get a chance to become a manager :rolleyes:, that is a real chance to afford Ford Mustang GT... someday :-\ .

                    lifecycle of a lifecycle of a lifecycle

                    P Offline
                    P Offline
                    Pedro H Fialho
                    wrote on last edited by
                    #9

                    Lol. Btw, to add some background, I'm a contractor at a company that bought another company in the same business. A very successfull software came in the bundle (and of course they plan to merge its features into their own software), but little to no documentation came along and now people are having a hard time figuring bugs things out. It is BS at so many levels, indeed, but the other products make up for it.

                    1 Reply Last reply
                    0
                    • P Pedro H Fialho

                      Just found this:

                          private void trySave(ref clsWord objWord, string strFullPath, Format format)
                          {
                              try
                              {
                                  objWord.save(strFullPath, format);
                              }
                              catch (InvalidOperationException ex)
                              {
                                  if (ex != null)
                                  {
                                      trySave(ref objWord, strFullPath, format);
                                  }
                              }
                          }
                      
                      D Offline
                      D Offline
                      dexterama
                      wrote on last edited by
                      #10

                      The good news is that developer's probably not writing code anymore. Probably your boss by now!

                      "If Crime Fighters fight crime, and Fire Fighters fight fire, what do Freedom Fighters fight?" - George Carlin

                      1 Reply Last reply
                      0
                      • P Pedro H Fialho

                        Just found this:

                            private void trySave(ref clsWord objWord, string strFullPath, Format format)
                            {
                                try
                                {
                                    objWord.save(strFullPath, format);
                                }
                                catch (InvalidOperationException ex)
                                {
                                    if (ex != null)
                                    {
                                        trySave(ref objWord, strFullPath, format);
                                    }
                                }
                            }
                        
                        B Offline
                        B Offline
                        Brisingr Aerowing
                        wrote on last edited by
                        #11

                        :doh:

                        <voice type="Ebeneezer Scrooge"> Bah. dumb bugs </voice>

                        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