PDA

View Full Version : Solved: Checking to see if a variable is = to another variable



Daxton A.
07-14-2004, 01:13 PM
Does anyone know how to do this?


Let's say that I have this loop and I want it to test a variable and see if it is = to a value but I don't want to make that variable = to that value. I remember how to do it in C++. All ya have to do is use another =, but I can't remember how it was done in visual basic.

Example in C++:
intTest == 12

HalfAce
07-14-2004, 01:25 PM
Hi,

Not sure if I'm understanding completely, but you might try
If intTest = 12 Then
(Or if this 12 is going to be entered as text) If intTest = "12" Then
Either way you'll need to include an End If somewhere before the end of your routine. (Just where can be important depending on the rest of your code...)

Is this what you're after?
Dan

Daxton A.
07-14-2004, 01:34 PM
What if you want to test a variable though, then what is used.

EX: variable = variable

HalfAce
07-14-2004, 01:37 PM
You would just reference them both by name. Such as

If Variable1 = Variable2 Then

Zack Barresse
07-14-2004, 01:39 PM
If I understood you..

If inTest = inTest2 Then

Just substitute the variables for what you want. Is this hitting close? Not sure if it's what you're looking for. If still not, how about posting the whole, or a portion, of your code.

Daxton A.
07-14-2004, 01:43 PM
Thank You both for the help