Hi,
How can I programmatically change the back color of a single cell in a listview using its own value?
The values in the ColorFlag Column Came from the database.
Here is my code:
foreach(DataRow dr in _dataTbl.Rows)
{
_markOW = dr["Mark"].ToString();
_stock = dr["Stock"].ToString();
_SteelSectio = dr["SteelSection"].ToString();
_colo = (Int32)dr["Color"];
ListViewItem _lvi = new ListViewItem(_markOW);
_lvi.SubItems.AddRange(new string[]{_SteelSectio, _stock, _colo.ToString()});
_myListView.Items.Add(_lvi); }
Here is the code that I have tried to change the backcolor of the cells:
for (int _i = 0; _i < _owLV.Items.Count; _i++)
{
_myListView.Items[_i].UseItemStyleForSubItems = false;
_myListView.Items[_i].SubItems[3].BackColor = Color.FromArgb(_colo);
}
Thanks in advance