I'm trying to apply some style formatting to a datagridview at the start of my program. Here is the body of the method which does this:
foreach (DataGridViewRow row in dataGridView1.Rows)
if (row.Cells.FormattedValue.ToString() != "Blah")
row.DefaultCellStyle.BackColor = Color.DarkGray;
This method is called at the very end of my constructor, and does in fact pop the the "IN" message. The problem is that the cells don't change color as they should. I have also put a button on my form, and set the event handler to do nothing but call this same method. For some reason when I click on the button, the cells DO in fact change color as they should.
Does anyone know why I cannot change the backColor of the cells in the constructor, but I can in some random eventHandler?