I want my (readonly,fullrowselect) datagridviews to have no selected rows when the form is loaded. I tried .ClearSelection in the forms constructor after setting their datasource but it doesn't work (i would really like to know why...).
Then i tried in the Form_load event but it won't clear the selection on the datagridviews i have placed on the not immediately visible tab containers.
Am i doing something wrong? I could do it in the Layout event of each tab page but then it will deselect the rows every time the user changes tab, which is not a desired behavior.
I found out that it's not working in FormLoad but works fine in FormShown. So you only have to set your dataGridView1.ClearSelection in your FormShown and everything works fine.
Try call an
yourGridView.Update();
after calling the
ClearSelection();
to redraw the grid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With