Naveed Zaman

Naveed Zaman

  • 328
  • 5.5k
  • 1.5m

List View Control for desktop application

Jul 18 2015 2:16 AM
Dear Team Hi,
I want change the color of deleted marked row in Listview control for example RED. data is coming from database.


foreach (DataRow myrow in table4.Rows)

 {


listView2.Items.Add(myrow[0].ToString());

listView2.Items[listView2.Items.Count -1].SubItems.Add(myrow[1].ToString());

listView2.Items[listView2.Items.Count -1].SubItems.Add(myrow[2].ToString());

if (myrow[3].ToString() == "Deleted")
{


listView2.Items[0].UseItemStyleForSubItems = false;

listView2.Items[0].SubItems[1].ForeColor = Color.Red;

listView2.Items[0].SubItems[2].ForeColor = Color.Red;

}

else {

listView2.Items[0].UseItemStyleForSubItems = false;

listView2.Items[0].SubItems[1].ForeColor = Color.Green;

listView2.Items[0].SubItems[2].ForeColor = Color.Green;

}


 

Answers (2)