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.
  • 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:

    U Offline
    U Offline
    unrealweapon
    wrote on last edited by
    #5

    is your former staff in hell now ? LOL

    S 1 Reply Last reply
    0
    • U unrealweapon

      is your former staff in hell now ? LOL

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

      I saw her with her husband. I think she is in hell now. YES! She is a woman!

      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:

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

        Did you sack her for?

        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 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:

          J Offline
          J Offline
          jhwurmbach
          wrote on last edited by
          #8

          SalarSoft wrote:

          IF TextBox1.Text=1 or 2 or 3 THEN

          Being VB illiterate... This does work as I fear it does? It sets the TextBox1.text to be "1" and then branches into the THEN, because 2 is equal to TRUE?

          Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
          Douglas Adams, "Dirk Gently's Holistic Detective Agency"

          C 1 Reply Last reply
          0
          • J jhwurmbach

            SalarSoft wrote:

            IF TextBox1.Text=1 or 2 or 3 THEN

            Being VB illiterate... This does work as I fear it does? It sets the TextBox1.text to be "1" and then branches into the THEN, because 2 is equal to TRUE?

            Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
            Douglas Adams, "Dirk Gently's Holistic Detective Agency"

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

            jhwurmbach wrote:

            It sets the TextBox1.text to be "1"

            Nope. Since it follows the IF statement, VB evaluates TextBox1.Text=1 as a conditional expression (I don't know if it results in a run-time error).

            jhwurmbach wrote:

            and then branches into the THEN, because 2 is equal to TRUE?

            Yes. :)

            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 1 Reply Last reply
            0
            • C CPallini

              jhwurmbach wrote:

              It sets the TextBox1.text to be "1"

              Nope. Since it follows the IF statement, VB evaluates TextBox1.Text=1 as a conditional expression (I don't know if it results in a run-time error).

              jhwurmbach wrote:

              and then branches into the THEN, because 2 is equal to TRUE?

              Yes. :)

              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
              #10

              CPallini wrote:

              (I don't know if it results in a run-time error)

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

              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:

                (I don't know if it results in a run-time error)

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

                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
                #11

                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]

                R L S 3 Replies 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]

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

                  Really? Works fine for me in Access 2003. It will throw an error if Textbox1 is empty, since you can't coerce a comparison with an empty string (or a null).

                  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
                  • 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]

                    L Offline
                    L Offline
                    Luc Pattyn
                    wrote on last edited by
                    #13

                    CPallini wrote:

                    Unfortunately I have no VB6 at hand

                    Unfortunately X|

                    Luc Pattyn [Forum Guidelines] [My Articles]


                    This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                    C 1 Reply Last reply
                    0
                    • C CPallini

                      Did you sack her for?

                      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
                      #14

                      No, we deported her and her friend cause they didn't skilled and they did lots of such mistakes ( I remember their nightmare creatures ). For example she named a function to something like this "girgo". X| Because of this naming, my friends named her "girgo". :laugh: Now the corporation focused on C#

                      1 Reply Last reply
                      0
                      • R Robert Royall

                        Really? Works fine for me in Access 2003. It will throw an error if Textbox1 is empty, since you can't coerce a comparison with an empty string (or a null).

                        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
                        #15

                        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 1 Reply Last reply
                        0
                        • L Luc Pattyn

                          CPallini wrote:

                          Unfortunately I have no VB6 at hand

                          Unfortunately X|

                          Luc Pattyn [Forum Guidelines] [My Articles]


                          This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


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

                          In fact I like a lot of weird things... ;)

                          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:

                            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
                                          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