Background of cell in a DataGridView <p>I've been playing around with datagridviews for a bit and a question has came up. -> Doesn't changing a cells background work out of the CellFormatting event. I've tried this:</p> <pre><code>private void dataGridView1_CellFormatting(object sender, dataGridViewCellFormattingEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name.Equals(dnsList.First&lt;String&gt;())) { DataGridViewRow row = dataGridView1.Rows[e.RowIndex]; DataGridViewCell cell = row.Cells[e.ColumnIndex]; cell.Style.BackColor = Color.FromArgb(194, 235, 211); } } </code></pre> <p>Which works perfectly, whereas this:</p> <pre><code>private void ApplyColoring() { if (dataGridView1.DataSource != null) { foreach (DataGridViewRow dataGridRow in dataGridView1.Rows) { DataGridViewCell cell = dataGridRow.Cells[dnsList.First&lt;String&gt;()]; cell.Style.BackColor = Color.FromArgb(194, 235, 211); } } } </code></pre> <p>Debugging tells me everything is sound, null-reference-or-whatever-exception-wise... Any tips?</p>