Click here to Skip to main content
15,997,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a datagridview in my apps and having a button to add a new row to datagridview, for that I've set AllowUserToAddRows to true on ADD button click event. I want the focus to be on that newly added row and able to enter some data, as of now my ReadOnly property is set to false and that of editmode is on KeyStroke
Can anyone help me to proceed further and I'm really getting struck over here and could not proceed since can do further only if this works

I'm able to add a new row on button click ADD(AllowUserToAddRows = true) on click event, I set the read only property of column to false and was able to enter data in the newly added row.
and able to set the focus to newly added row

dgDtParameters.Rows[dgDtParameters.Rows.Count - 1].Selected = true;

removed the focus of datagridiview by adding
ClearSelection()
Posted
Updated 28-Aug-11 21:08pm
v2

1 solution

Does setting the CurrentCell[^] property help?
 
Share this answer
 
Comments
CyborgForever 29-Aug-11 2:30am    
Nope, my DGV is already databound, I'm displaying few data on dgv and then on button click add a new row and focus on that row to add data
dan!sh 29-Aug-11 3:01am    
I just tried this with a bound DataGridView and it works fine for me. Could you post the code you are using? Please update your question with the code and reply to this comment for I too will get notified.

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