How do I change the datagridview selected row background color?

Lawrance Rozario picture Lawrance Rozario · Jul 5, 2010 · Viewed 80k times · Source

How do I change the datagridview selected row background color in C# windows applications?

Answer

Bravo picture Bravo · Oct 9, 2012

Come on man... there has to be a simple solution, and finally got one.

dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Blue;
dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Red;

This worked for me, no complex codes, no event handling. I did it before but was not able to recall so thought posting it would help others and me in future :)