Hi,
When DateGridView is in edit mode, enter Key is processed in ProcessDialogKey() method. When DataGridView is not in edit mode, we can override ProcessDataGridViewKey() to change the navigation.
There is a FAQ tells about this:
9. How can I make the Enter key work as Tab key?
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/a44622c0-74e1-463b-97b9-27b87513747e#faq9
And the following is VB.NET code:
Public Class MyDataGridView
Inherits DataGridView
Protected Overrides Function ProcessDataGridViewKey(ByVal e As KeyEventArgs) As Boolean
If e.KeyCode = Keys.Enter Then
Me.ProcessTabKey(e.KeyData)
Return True
End If
Return MyBase.ProcessDataGridViewKey(e)
End Function
Protected Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
If keyData = Keys.Enter Then
Me.ProcessTabKey(keyData)
Return True
End If
Return MyBase.ProcessDialogKey(keyData)
End Function
End Class
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.