Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigate to cell in dataGridView

Status
Not open for further replies.

gharabed

Programmer
Sep 7, 2001
251
US
I want to programmatically navigate to a cell within a dataGridView and once navigated there, I want the cursor to appear such that the cell is automatically in edit mode. Just as if the user mouse clicked on the cell just before beginning their editing of the data in the cell.

I can set the current cell using the following if I want to navigate to the "LastName" cell in the first row:

Code:
        personnelDataGrid.CurrentCell = personnelDataGrid.Rows(0).Cells("LastName")

It navigates to the row but the cell is not in edit mode as if somebody clicked on the cell. I have the editMode set to "editOnEnter". Any ideas?
 
I didn't think you could do it that way, but it works if you set the focus to the grid after setting the current cell. So just add personnelDataGrid.Focus() and it should work.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top