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
After three hours of troubleshooting this, I've figured it out: Your DataGridView needs to be displayed on the screen before calling dataGridView.ClearSelection().
How I know this works:
I have two DataGridViews, each in a different panel. Only one panel is visible at a time. In the panel that's initially visible, the DataGridView has never ignored my call to ClearSelection(), so I've never seen a row selected right away.
I used to populate the other DataGridView and clear its selection before showing the panel that contains it, but that top row was always still highlighted. I changed my code to display the other panel before clearing the DataGridView's selection, and the call to ClearSelection() worked as it should.