I have created a listview in my C# form and when i add an item through my code I change the background color of my cells/rows. However, when i scroll over them at runtime the color defaults back to white and then they stay white. I have different tab pages in my form. If I switch to a different tab page and then come back the colors will be back where they were until they are selected or scrolled over again. Is this simply a glitch in VS? I have no idea how to fix it. When I enter items into the listview I am using the following code.

ListViewItem li = new ListViewItem(le.TimeStamp.ToString());

			//Allows us to use different fonts, backgroud colors, etc. for individual items within a row on the 

			//list view and for entire rows themselves

			li.UseItemStyleForSubItems = false; 


			string mt = "";

			//depending on the type of message that is being logged to the case tab a color indicator is chosen

			//to be displayed in the "Indicator" column

			switch(le.MessageType)

			{

					//display a green indicator bar and a message for "Informational"

				case "Informational":

				{

					mt = "Informational";

					li.SubItems.Add(mt);

					li.SubItems.Add("");

					li.SubItems.Add(le.Message);

					li.SubItems[2].BackColor = Color.Green;

					CaseLogListView.Items.Add(li);

					break;

				}
		}
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.