I'm trying to determine if a value in an array element is equal to another value.
I have the following code set up, but it's not working as expected (unless I'm using it incorrectly):
<code>
If Convert.ToUInt64(CDRElements(1)).Equals(objSrchMaster.objSrchObj(i).Pos) Then
blnCondition = True
Else
blnCondition = False
End If
</code>
While debugging in the immediate window, the value of Convert.ToUInt64(CDRElements(1)) = 6
and the value of objSrchMaster.objSrchObj(i).Pos = 6
which is the same value.
Unless I'm using this method incorrectly, I don't know why it falls thru to the FALSE statement instead of the TRUE STATEMENT IN THE ABOVE CODE.
How can I compare these two values (one in an array element) to get the expected result

array equals method
tculler
That is correct. It worked fine...
Thanks so much....
ruben_ruvalcaba_camba
Julien Gourdet SOPRA
Equals is used for comparing object references which in this case I probably doubt that they are the same references. I think what you need is actually a simple = instead of equals
If Convert.ToUInt64(CDRElements(1)) = objSrchMaster.objSrchObj(i).Pos Then
blnCondition = True
Else
blnCondition = False
End If
If not sure why you are using Convert.toUInt64 but you could probably use Ctype to cast the value to the same type.