Hi all,
I have a listview to display data from a datareader, while theReader is
lopping, how do I change the font color(for the whole row) depending on a
value of a column?
I'm trying to do something like this: (obviously it's not working...)
Do While theReader.Read
itmx = New ListViewItem
itmx.Text = (theReader("Cancel"))
If theReader("Cancel") = "Y" then
itmx.ForeColor.Green '<----------
else
itmx.ForeColor.Black '<----------
end if
lvwRoster.Items.Add(itmx)
Loop
Thanks!
Kay
Kyle Burmark - 30 Dec 2005 22:48 GMT
Try something like this
Do While theReader.Read
itmx = New ListViewItem
itmx.Text = (theReader("Cancel"))
If theReader("Cancel") = "Y" then
itmx.ForeColor.Green '<----------
else
itmx.ForeColor.Black '<----------
end if
itmx.UseItemStyleForSubItems = true; //look here, do this or
else loop through the item's subitems and set each one's forecolor
lvwRoster.Items.Add(itmx)
Loop
> Hi all,
>
[quoted text clipped - 18 lines]
>
> Kay