Hi,
My code below will loop through my DGV rows and if the requested string is found the cell color should change.
However, sometimes the code needs to be called multiple times for cell change to take effect.
Any ideas?
Thanks!
foreach (DataGridViewColumn col in myDataGridView.Columns) { foreach (DataGridViewRow row in myDataGridView.Rows) { if (row.Cells[col.Name].Value != null) { if (row.Cells[col.Name].Value.ToString().IndexOf(TextToFind, StringComparison.InvariantCultureIgnoreCase) != -1) { // highlight cell row.Cells[col.Name].Style.BackColor = Color.LightYellow; } } } }