Variant Comparison 
Author Message
 Variant Comparison

When comparing variant values using:

varNew <> varOld  

I get an invalid procedure call 5.  

In this case the values are the same,  4 charater string containing
Chr(0), Chr(0), Chr(0), Chr(63) or Null, Null, Null, ?

In windows 2K, this does not fail.
In windows 98 It does.

I am not sure as to why, but I believe that because of the first charater being a
NULL, the <> is treating them both as NULL.  This may be the problem.

Any comments or ideas about this problem and why it works in 2K but not 98 would
be appreciate.  



Sat, 22 Nov 2003 22:30:27 GMT  
 Variant Comparison
A character can't be Null, so something else
is going on.  What do you get if you type this
in in the immediate window:

print VarType(varNew), VarType(varOld)


When comparing variant values using:

varNew <> varOld

I get an invalid procedure call 5.

In this case the values are the same,  4 charater string
containing
Chr(0), Chr(0), Chr(0), Chr(63) or Null, Null, Null, ?

In windows 2K, this does not fail.
In windows 98 It does.

I am not sure as to why, but I believe that because of the first
charater being a
NULL, the <> is treating them both as NULL.  This may be the
problem.

Any comments or ideas about this problem and why it works in 2K
but not 98 would
be appreciate.



Sun, 23 Nov 2003 03:02:17 GMT  
 Variant Comparison

Quote:
> A character can't be Null, so something else

For one of the (at least five different) meanings of "Null" it certainly
can: it can equal VBNullChar = Chr$(0)

I suspect the original poster has sussed the source of his problem.  Wish I
knew how to help him with it...

Jim Deutch
MS Dev MVP

Quote:
> is going on.  What do you get if you type this
> in in the immediate window:

> print VarType(varNew), VarType(varOld)



> When comparing variant values using:

> varNew <> varOld

> I get an invalid procedure call 5.

> In this case the values are the same,  4 charater string
> containing
> Chr(0), Chr(0), Chr(0), Chr(63) or Null, Null, Null, ?

> In windows 2K, this does not fail.
> In windows 98 It does.

> I am not sure as to why, but I believe that because of the first
> charater being a
> NULL, the <> is treating them both as NULL.  This may be the
> problem.

> Any comments or ideas about this problem and why it works in 2K
> but not 98 would
> be appreciate.




Mon, 24 Nov 2003 00:03:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Array and variant comparison

2. Inconsistent Variant comparison

3. Array to Variant and Variant to array problem

4. Assign Object to Variant and then Variant to Object

5. Variant vs. String data type, is not Variant less efficient?

6. array of variants vs. a variant array for marshalling

7. Variant array vs. array of variant.

8. Coercing A Variant Array of Variants into an integer array.

9. Variant Array --> ByteArray() --> Variant Array

10. String comparison does not work

11. Null comparison with string

12. Text comparison

 

 
Powered by phpBB® Forum Software