We help IT Professionals succeed at work.

datagridview trap enter key, vb.net, winforms

TrialUser
TrialUser asked
on
I have a datagrid view in a VB.net winforms application. Whenever the user presses the enter key in the datagridview, the currentcell should be changed to the last row first cell. I am able to achieve this using preview_keydown event. However when the user changes the value of a particular cell and then press enter key, these events are not trigerred. How can I trap the enter key press after a cell value was changed and set the current cell value to the last row first cell. Please help. Thanks. Any suggestion would be great
Comment
Watch Question

can you try the event CellValueChanged?
Commented:
I always use the keyup event and it works for me. Add the code to your keyup event.
It would be something like:
datagridview1.currentcell = datagridview1,rows(datagridview1.rows.count -1).cells(0)

Author

Commented:
The keyup event worked thanks