Click here to Skip to main content
15,791,892 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I'm adding a new row to a bound datagridview, by adding the new row to the underlying dataset which is bind to DGV. When the new row is added I want to set focus to newly added row's first column how can I achieve this.

Thanks in advance

1 solution

Handle the RowsAdded event of the DataGridView.
Then add
dgv.Rows(e.RowIndex).Selected = true;
in that particular event.
Share this answer
CyborgForever 1-Nov-11 6:43am    
I'am also adding row to bound DGV in that when it AllowUsersToAddrow=true, the event is fired and I get an exception Row index provided is out of range.
Parameter name: rowIndex

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900