When I fill a DataGridView row by row (calling it\'s add function), the top row gets blue colored. It\'s not selected because I tried ClearSelection() also but it didnt work
I tried the above methods but nothing worked for me.
Finally, I just decided to set the default colors for selected cells to be the same as non-selected cells.
Then, in the cell click method, I set them back. That way nothing appears selected until its clicked, which was sufficient for my application. Here's the code I used in the click method to set everything back to normal:
dataGridView.DefaultCellStyle.SelectionBackColor = SystemColors.Highlight;
dataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window;
Annoyingly, the ClearSelection method actually works just fine if I put it in a button, but if I create the control which contains the datagrid, load some data into it, and then try to clear it right then, it doesn't work. I wish I knew why...