2
Answers

List View Control for desktop application

Naveed Zaman

Naveed Zaman

9y
580
1
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)