DataGridView - How to disable jumping on next row on Hit ENTER?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have problem, on modal dialog, user has to select one value from
DataGridView. AcceptButton is set on Form, but DataGridView jump on next row
on user Enter, so wrong row is selected.

Any suggestion how to disable jumping to next row when user hit Enter button?

Thanks
MilanB
 
MilanB said:
Hello,

I have problem, on modal dialog, user has to select one value from
DataGridView. AcceptButton is set on Form, but DataGridView jump on next row
on user Enter, so wrong row is selected.

Any suggestion how to disable jumping to next row when user hit Enter button?

Thanks
MilanB

Can you not handle the KeyPress event of the DataGridView and check for
the Enter key?
 
Thanks Chris!

KeyPress did not work.
but I handled "KeyDown" Event.
{
if (e.KeyCode == Keys.Enter)
e.Handled = true
}

That disabled control undesired behavior.

Thanks again
MilanB
 
Back
Top