C# DataGridView Color text of single row
c#, coding-style, datagridview
Solution
Try this format:
dgvRIM.Rows[myRow].Cells[0].Style.ForeColor = Color.Red;
If you want to set the entire row, loop over all cells.
Problem
I have a DataGridView that has a class as its DataSource. The class contains an ID string, 2x DateTimes and a Boolean. I have written some code to change the text of a row that matches an ID I pass to method to Red, but nothing I have tried works. This is what I have so far: ``` public void ShowInstanceAsTerminated(String id) { foreach (DataGridViewRow dgvRow in dgvRIM.Rows) { if (dgvRow.Cells[0].Value.ToString() == id) { dgvRow.DefaultCellStyle.ForeColor = Color.Red; } } } ``` This is one of many variations of code I have tried, but the cells in question never change!! Thanks Neil