Problem with ForeColor with Listview

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

Guest

I have the following code below. The objective is to change the forecolor of
the item if the item being added is different from the last item. Well it's
not working. When I step thru the code it's going to the correct areas when
the lastitem not equal to current item but it's not changing the foreground
color. Any ideas why. Thanks

Do
line = sr.ReadLine()
If line Is Nothing Then
Else
If LastItem <> ListItem(line) Then
LastItem = ListItem(line)
ListView1.ForeColor = Color.Red
ListView1.Items.Add(line)
Else
LastItem = ListItem(line)
ListView1.Items.Add(line)
End If
End If
ListView1.ForeColor = Color.Black
Loop While Not line Is Nothing
 
Mike,

Although your question is the same in all languages, is it because you show
it in VBNet, probably a better question for one of the most active developer
newsgroups

microsoft.public.dotnet.languages.vb

You have of course not to change the color of your listview but the items,
that is so nice from the listview it exist from independend items. However I
never did that and in the newsgroup languages.vb are probably a lot who can
give you the answer direct.

However, I found this, so maybe this helps you.

http://msdn2.microsoft.com/en-us/library/w1s4137w.aspx

Cor
 
Back
Top