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