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. Professional conditions with IF

Professional conditions with IF

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharphelpquestion
26 Posts 13 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.
  • C CPallini

    Robert Royall wrote:

    Really?

    Yes.

    Robert Royall wrote:

    Works fine for me in Access 2003.

    I'm using Excel 2002. But I think that VBA version difference doesn't really matter in this case.

    Robert Royall wrote:

    It will throw an error if Textbox1 is empty, since you can't coerce a comparison with an empty string (or a null).

    IMHO it will NOT throw only if the Textbox1.Text value can be coerced to a number (i.e. Runtime Error if Textbox1.Text is equal to "foo"). :)

    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.
    [my articles]

    R Offline
    R Offline
    Robert Royall
    wrote on last edited by
    #17

    CPallini wrote:

    Runtime Error if Textbox1.Text is equal to "foo"

    But... why on earth would that throw a Runtime Error? F00 is 3840... :wtf:

    Please don't bother me... I'm hacking right now. Don't look at me like that - doesn't anybody remember what "hacking" really means? :sigh:

    C 1 Reply Last reply
    0
    • R Robert Royall

      CPallini wrote:

      Runtime Error if Textbox1.Text is equal to "foo"

      But... why on earth would that throw a Runtime Error? F00 is 3840... :wtf:

      Please don't bother me... I'm hacking right now. Don't look at me like that - doesn't anybody remember what "hacking" really means? :sigh:

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

      Because VB isn't such smart on number representations :-D

      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.
      [my articles]

      1 Reply Last reply
      0
      • C CPallini

        Robert Royall wrote:

        It shouldn't; nearly all flavors of VB automatically coerce numerics into strings.

        I was quite confident about too, but my VBA actually doesn't like the mix. Unfortunately I have no VB6 at hand. :)

        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.
        [my articles]

        S Offline
        S Offline
        SalarSoft
        wrote on last edited by
        #19

        CPallini wrote:

        Unfortunately I have no VB6 at hand.

        You're lucky! ;P

        C 1 Reply Last reply
        0
        • S SalarSoft

          CPallini wrote:

          Unfortunately I have no VB6 at hand.

          You're lucky! ;P

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

          Nope. http://www.codeproject.com/script/Forums/View.aspx?fid=392254&msg=2393634[^] :-D

          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.
          [my articles]

          U 1 Reply Last reply
          0
          • S SalarSoft

            One of our former staff wrote this professional IF clause in VB.NET(Hell language) IF TextBox1.Text=1 or 2 or 3 THEN ' Go to hell END IF :wtf: I tried to write codes like this, but couldn't. Can you help to write? :omg:

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

            SalarSoft wrote:

            VB.NET

            That is why it is Very Bad.

            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

            1 Reply Last reply
            0
            • R Rich Insley

              It's not uncommon at all to see coders express their frustrations in the code they write. For an entertaining afternoon of reading, go to http://www.google.com/codesearch[^] and enter the profanity of your choice. You'd be amazed what people say.

              J Offline
              J Offline
              John R Shaw
              wrote on last edited by
              #22

              :laugh: :laugh: :laugh: :laugh: :laugh: Thanks for the link, I needed a good laugh. ;)

              INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

              1 Reply Last reply
              0
              • R Rich Insley

                It's not uncommon at all to see coders express their frustrations in the code they write. For an entertaining afternoon of reading, go to http://www.google.com/codesearch[^] and enter the profanity of your choice. You'd be amazed what people say.

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #23

                JohnnyLocust wrote:

                http://www.google.com/codesearch

                Very interesting. Put in my name and found an old Java program I wrote back in college.

                "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

                1 Reply Last reply
                0
                • C CPallini

                  Nope. http://www.codeproject.com/script/Forums/View.aspx?fid=392254&msg=2393634[^] :-D

                  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.
                  [my articles]

                  U Offline
                  U Offline
                  User 2558377
                  wrote on last edited by
                  #24

                  This kind of thing is standard shortcut syntax in COBOL (or was when I last used COBOL many years ago): IF X = 1 OR 2 THEN... is the same as IF X = 1 OR X = 2 THEN... The big gotcha comes when you add a NOT into the mix. All new COBOL programmers would at some point write a statement like: IF X NOT = 1 OR 2 THEN.. which unfortunately expands to IF X NOT = 1 OR X NOT = 2 THEN.. so the condition is always satisfied. Some of those beginners learn from the experience and don't make the mistake again. Others, however....

                  C 1 Reply Last reply
                  0
                  • U User 2558377

                    This kind of thing is standard shortcut syntax in COBOL (or was when I last used COBOL many years ago): IF X = 1 OR 2 THEN... is the same as IF X = 1 OR X = 2 THEN... The big gotcha comes when you add a NOT into the mix. All new COBOL programmers would at some point write a statement like: IF X NOT = 1 OR 2 THEN.. which unfortunately expands to IF X NOT = 1 OR X NOT = 2 THEN.. so the condition is always satisfied. Some of those beginners learn from the experience and don't make the mistake again. Others, however....

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

                    Member 2560472 wrote:

                    Some of those beginners learn from the experience

                    ...and quicky abandon COBOL. :laugh:

                    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.
                    [my articles]

                    1 Reply Last reply
                    0
                    • R Rich Insley

                      It's not uncommon at all to see coders express their frustrations in the code they write. For an entertaining afternoon of reading, go to http://www.google.com/codesearch[^] and enter the profanity of your choice. You'd be amazed what people say.

                      T Offline
                      T Offline
                      TheGreatAndPowerfulOz
                      wrote on last edited by
                      #26

                      Buttmunch

                      Silence is the voice of complicity. Strange women lying in ponds distributing swords is no basis for a system of government. -- monty python Might I suggest that the universe was always the size of the cosmos. It is just that at one point the cosmos was the size of a marble. -- Colin Angus Mackay

                      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