Hi,
A question if I need to compare two values (as strings) and use the StrComp() function in VB.Net as below:
ResultReadBackTest = StrComp(ValResultPastEquals, Value_Sx_Calculated_String)
What it does is checks the values read back from a device and compares it to what was sent.
The device only deals with strings.
However I can see issues with this method as I have lashed up a quick program to test
Dim ValueA As String
Dim ValueB As String
Dim Result As Integer
ValueA = "0011059096"
ValueB = "11059096"
Result = StrComp(ValueA, ValueB)
MsgBox("Result = " + Result.ToString())
The values I have got from the program I have written are 0011059096 and 11059096
which gives a 1, meaning from the MSDN page Value1 sorts after Value2 ??
I know if I did a substring and got rid of the leading zero's it might work but that could be dangerous. Opions please on the following:
intValA = Val(ValueA)
intValB = Val(ValueB)
MsgBox("Value A = " + intValA.ToString() + " Value B = " + intValB.ToString())
If (intValA = intValB) Then MsgBox("Huzzah")
or to put it cleanly
convert use Val to convert ValueA to an integer and the same for ValueB and do a compare...
Seems a little too easy...
Glenn
(I dislike VB...)