Formating Listview

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to compare two columns of a listview.
I use this:
If lvw_Asign.ListItems(X).ListSubItems(4) >
lvw_Asign.ListItems(X).ListSubItems(5) Then

but if the numbers are if 47 < 490 then, the result is that 490 is not
bigger than 47 .

How can I make this comparative situation to work?

Thanks a lot, Lina
 
Try to "convert" to numbers:

If Val(lvw_Asign.ListItems(X).ListSubItems(4)) >
Val(lvw_Asign.ListItems(X).ListSubItems(5)) Then
 
Hi Alex,
I did that, but it did not work.
What I did, and it worked is that I added a 0 to each side of the equation
like this:
lvw_Asign.ListItems(X).ListSubItems(4) +0 >
lvw_Asign.ListItems(X).ListSubItems(5) +0 Then
And it worked. Why? I do not know...

Thanks a lot, Lina
 
Well, this is strange, but fine if it works
once you made:
lvw_Asign.ListItems(X).ListSubItems(4) +0
then value of lvw_Asign.ListItems(X).ListSubItems(4) was converted to
number, in order to add 0 (also number) - that is why you get correct result
Val() function do the same thing, but for some reason it did not work here
 
Back
Top