I am having a bit of trouble colorizing a listview sorted with strongm's API sorting of a listview used in thread222-578008. The colorizing code turns negative numbers red and positive numbers green. It works swimmingly for standard alphabetic sorting, but when the API sorting is used, it colorizes them wrong.
I am guessing the problem lies with the way I am parsing through the listview. I notice the first entry in the loop is really item 200 in the list. However, when I apply the color, it is applying it to the first visible item in the list, not item 200. Either this is very tricky or very simple, I am just not figuring it out. Thanks in advance for the help.
My code for colorizing is:
I am guessing the problem lies with the way I am parsing through the listview. I notice the first entry in the loop is really item 200 in the list. However, when I apply the color, it is applying it to the first visible item in the list, not item 200. Either this is very tricky or very simple, I am just not figuring it out. Thanks in advance for the help.
My code for colorizing is:
Code:
Private Sub ColorizeEntries()
Dim i As Integer
For i = 1 To lstvwList.ListItems.Count
If lstvwList.ListItems(i).SubItems(4) > 0 Then
lstvwList.ListItems(i).ListSubItems(4).ForeColor = &H8000&
Else
lstvwList.ListItems(i).ListSubItems(4).ForeColor = &HC0&
End If
Next
lstvwList.Refresh
End Sub