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

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
 
C

Chris Dunaway

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?
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top