C# – How to change the datagridview selected row background color

c++datagridviewwinforms

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

Best Solution

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 :)