disable the default Enter/Return key behavior in a datagridview
You can try something like this in the gridview key down event
Private Sub DataGridView1_Keydown (...) Handles DataGridView1.KeyDown
If e.KeyCode = Keys.Enter Then
' Your code here
e.SuppressKeyPress = True
End If
End Sub
Another option would be to create a custom grid view control
DataGridView.ProcessDataGridViewKey Method
You can just use keyPress event:
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
//You're Code
}
e.Handled = true;
return;
}