Putting a DataGridView cell into Edit Mode

Spent quite a bit of time trying to find out how to do this. When a user wants to add a new value to a DataGridView I have an Add New button.

This adds the new row, but then I want the only cell in the row to be initially set to edit mode. Eventually found the code to do this:

grdData.Rows(LastRow).Cells.Item(0).Selected = True
grdData.BeginEdit(True)

This first selects the cell to edit then forces it to edit.


Posted: 31. October 2006 15:37 by cutty
Categories: ASP.Net Coding Hints and Tips Tags: , ,