DatagridView on which Enter key works as TabMost of the user use Enter key except Tab to move focus in the next controls because it is very faster to press Enter key
instead of Tab key.
But in .net the DataGridView works with Tab key to move focus in Next cell so we need to customize the datagridView and
Overrides some function.
Add a new custom control in project and inherits it with System.Windows.Forms.DataGridView.
First Override ProcessDataGridViewKey function and write the following code.
Protected Overrides Function ProcessDataGridViewKey(ByVal e As System.Windows.Forms.KeyEventArgs) As Boolean
If e.KeyCode = System.Windows.Forms.Keys.Enter Then
Me.ProcessTabKey(e.KeyData)
Return True
End If
Return MyBase.ProcessDataGridViewKey(e)
End Function
Then Override ProcessDialogKey function as fillowes
Protected Overrides Function ProcessDialogKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean
If keyData = System.Windows.Forms.Keys.Enter Then
Me.ProcessTabKey(keyData)
Return True
End If
Return MyBase.ProcessDialogKey(keyData)
End Function
After that Build the application then you will find that there in a new control in your toolbox named as your custom control
name.
You can easily use this with drag and drop and in this datagridview enter key works as a tab key.