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. Operator variable reference

Operator variable reference

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
5 Posts 2 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.
  • W Offline
    W Offline
    WESHILL
    wrote on last edited by
    #1

    Hi, Could someone tell me if it is possible to reference an operator, such as "=" or "<" with a variable? For example: Dim Var1 as Interger Dim VarRefOperator as ????? Var1 = 10 VarRefOperator = "=" If Var1 VarOperator 10 Then ' If Var1 = 10 Msgbox("do something") End If Thanks, weshill

    D 1 Reply Last reply
    0
    • W WESHILL

      Hi, Could someone tell me if it is possible to reference an operator, such as "=" or "<" with a variable? For example: Dim Var1 as Interger Dim VarRefOperator as ????? Var1 = 10 VarRefOperator = "=" If Var1 VarOperator 10 Then ' If Var1 = 10 Msgbox("do something") End If Thanks, weshill

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

      There is no way to do that in VB.NET or any other of the 14 languages I'm familiar with. Frankly, I can't even think of a reason why you would want to do that... So, I'll ask, why would you want to do that? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      W 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There is no way to do that in VB.NET or any other of the 14 languages I'm familiar with. Frankly, I can't even think of a reason why you would want to do that... So, I'll ask, why would you want to do that? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        W Offline
        W Offline
        WESHILL
        wrote on last edited by
        #3

        I know it seems silly. I was hoping to limit my coding. This is what I am trying to do... I have a combo box with (=, <, >, <>) operators in it and a piece of code that executes depending on the operator the user selects. Without the option to assign the operator a variable my coding become slightly longer with the use of a select statment that checks each possible option. Thanks,

        D 1 Reply Last reply
        0
        • W WESHILL

          I know it seems silly. I was hoping to limit my coding. This is what I am trying to do... I have a combo box with (=, <, >, <>) operators in it and a piece of code that executes depending on the operator the user selects. Without the option to assign the operator a variable my coding become slightly longer with the use of a select statment that checks each possible option. Thanks,

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

          Unfortunately, that's what your going to have to do. Even if you were to make a class that did something like, internally, the class would have to check to see which operator was involved, then make the appropriate branch to do the comparison. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          W 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Unfortunately, that's what your going to have to do. Even if you were to make a class that did something like, internally, the class would have to check to see which operator was involved, then make the appropriate branch to do the comparison. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            W Offline
            W Offline
            WESHILL
            wrote on last edited by
            #5

            Thanks.

            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