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. General Programming
  3. Visual Basic
  4. how to use Compare?

how to use Compare?

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
12 Posts 4 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.
  • Z Offline
    Z Offline
    zhiyuan16
    wrote on last edited by
    #1

    dear all how to use compare in vb 6? thanks a lot

    D L 2 Replies Last reply
    0
    • Z zhiyuan16

      dear all how to use compare in vb 6? thanks a lot

      D Offline
      D Offline
      DaveAuld
      wrote on last edited by
      #2

      What do you want to compare? Objects, strings, numbers, give us a clue!

      Dave Please support my CPRepWatcher article in the August competition! Find Me On: Web|Facebook|Twitter|LinkedIn

      Z 1 Reply Last reply
      0
      • D DaveAuld

        What do you want to compare? Objects, strings, numbers, give us a clue!

        Dave Please support my CPRepWatcher article in the August competition! Find Me On: Web|Facebook|Twitter|LinkedIn

        Z Offline
        Z Offline
        zhiyuan16
        wrote on last edited by
        #3

        i want to compare 2 decimal value(0-255)

        D 1 Reply Last reply
        0
        • Z zhiyuan16

          i want to compare 2 decimal value(0-255)

          D Offline
          D Offline
          DaveAuld
          wrote on last edited by
          #4

          As in ;

          Dim a as byte: a = 34; 'I selected byte type as you stated 0-255 in your question
          Dim b as byte: b = 20;

          if a > b then
          msgbox("a is greater than b")
          elseif a < b then
          msgbox("a is less than b")
          else
          msgbox("a equals b")
          end if

          You cannot get any more basic than that! Surely you could have found out how to do that in the docs or on google.

          Dave Please support my CPRepWatcher article in the August competition! Find Me On: Web|Facebook|Twitter|LinkedIn

          Z 1 Reply Last reply
          0
          • D DaveAuld

            As in ;

            Dim a as byte: a = 34; 'I selected byte type as you stated 0-255 in your question
            Dim b as byte: b = 20;

            if a > b then
            msgbox("a is greater than b")
            elseif a < b then
            msgbox("a is less than b")
            else
            msgbox("a equals b")
            end if

            You cannot get any more basic than that! Surely you could have found out how to do that in the docs or on google.

            Dave Please support my CPRepWatcher article in the August competition! Find Me On: Web|Facebook|Twitter|LinkedIn

            Z Offline
            Z Offline
            zhiyuan16
            wrote on last edited by
            #5

            sorr, probably i made a mistake, i mean how to use "Compare" to compare 2 deccimal values; for example:compare = int(251 and 4)

            D 1 Reply Last reply
            0
            • Z zhiyuan16

              sorr, probably i made a mistake, i mean how to use "Compare" to compare 2 deccimal values; for example:compare = int(251 and 4)

              D Offline
              D Offline
              DaveAuld
              wrote on last edited by
              #6

              ???? I am comparing them, are they greater, less than or equal to other. So i am not exactly sure what you are on about now.

              Dave Please support my CPRepWatcher article in the August competition! Find Me On: Web|Facebook|Twitter|LinkedIn

              1 Reply Last reply
              0
              • Z zhiyuan16

                dear all how to use compare in vb 6? thanks a lot

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

                you already asked and got answers two days ago. I suggest you buy and study an introductory book on VB.NET :)

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                D Z 2 Replies Last reply
                0
                • L Luc Pattyn

                  you already asked and got answers two days ago. I suggest you buy and study an introductory book on VB.NET :)

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                  D Offline
                  D Offline
                  DaveAuld
                  wrote on last edited by
                  #8

                  Damn, if I had bothered to check his previous messages I would have seen this, and wouldn't have responded with what I had. I see what he is on about now! *kicks self in @rse*

                  Dave Please support my CPRepWatcher article in the August competition! Find Me On: Web|Facebook|Twitter|LinkedIn

                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    you already asked and got answers two days ago. I suggest you buy and study an introductory book on VB.NET :)

                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                    Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                    Z Offline
                    Z Offline
                    zhiyuan16
                    wrote on last edited by
                    #9

                    thanks sir, i knew this point, but that answer is not what i want. i just want to know after compare..what is result? the result is greater value or less value? i searched online and asked someone already. so still couldn't find solution.

                    L 1 Reply Last reply
                    0
                    • Z zhiyuan16

                      thanks sir, i knew this point, but that answer is not what i want. i just want to know after compare..what is result? the result is greater value or less value? i searched online and asked someone already. so still couldn't find solution.

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

                      the result of a comparison is a boolean value, i.e. either true or false, and not a number nor anything else. Now do yourself a favor: go buy a book and study. :)

                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                      Z 1 Reply Last reply
                      0
                      • L Luc Pattyn

                        the result of a comparison is a boolean value, i.e. either true or false, and not a number nor anything else. Now do yourself a favor: go buy a book and study. :)

                        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                        Z Offline
                        Z Offline
                        zhiyuan16
                        wrote on last edited by
                        #11

                        hahahahaha, i think you also need to buy this book to study hard, although my ability in vb6 is really limited, but i don't agree compare can only get boolen.

                        D 1 Reply Last reply
                        0
                        • Z zhiyuan16

                          hahahahaha, i think you also need to buy this book to study hard, although my ability in vb6 is really limited, but i don't agree compare can only get boolen.

                          D Offline
                          D Offline
                          Dave Kreskowiak
                          wrote on last edited by
                          #12

                          Actually, YOU do need to buy a book and study something called "binary math". Camparing something is usually a boolean result. But, in your simple example "compare = int(200 and 4)" this results in a binary AND operation on two values, resulting in a third value that is assigned to a variable called "compare".

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak

                          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