Reputation: 329
How change color line in listview .
for example if line == 4
then line is red
Upvotes: 4
Views: 35568
Reputation: 264
If you want to go through the whole list and colour each item conditionally, then you can use:
foreach (ListViewItem lvw in myListView.Items)
{
if (lvw.SubItems[x].ToString() == "True")
{
lvw.BackColor = Color.Red;
}
}
Or if you always want to color the item at index 4:
myListView.Items[4].BackColor = Color.Red;
Upvotes: 12
Reputation: 14521
Might the answer be as simple as following?
listView1.Items[3].BackColor = Color.Red;
Upvotes: 1