Changing colors of listview items..
-
I have a listview named redTagView.. I'd like to color the 4th column red or green depending on if it's an "N" or not. I've written the following code..
for (int i = 0; i < redTagView.Items.Count; i++) { if (redTagView.Items[i].SubItems[3].Text == "N") { redTagView.Items[i].SubItems[3].ForeColor = System.Drawing.Color.Red; } else { redTagView.Items[i].SubItems[3].ForeColor = System.Drawing.Color.Green; } }
The code sits there and stares at me like I'm an idiot. Makes me feel warm and fuzzy inside. Any reason why this shouldn't work? Tried redTagView.Refresh().. nothing. -
I have a listview named redTagView.. I'd like to color the 4th column red or green depending on if it's an "N" or not. I've written the following code..
for (int i = 0; i < redTagView.Items.Count; i++) { if (redTagView.Items[i].SubItems[3].Text == "N") { redTagView.Items[i].SubItems[3].ForeColor = System.Drawing.Color.Red; } else { redTagView.Items[i].SubItems[3].ForeColor = System.Drawing.Color.Green; } }
The code sits there and stares at me like I'm an idiot. Makes me feel warm and fuzzy inside. Any reason why this shouldn't work? Tried redTagView.Refresh().. nothing.