Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I send a single Downkey key when my user taps the numpad Enter key?

This is purely for a usability request my clients have asked me.

They work with a datagridview typing in grades for students. So they pretty much go into zombie mode and start tapping in numbers, and they've told me that it would be easier if they could tap the numpad enter key to have the next vertical select focused.

Here's what I've tried to use:

private void dataGridView1_KeyUp(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
    {
        SendKeys.Send("{DOWN}");
    }
}

Unfortunately, it doesn't work as expected. Sometimes it seems to fire that key many times, causing the focus to scroll 2 or 3 or 4 cells downwards and really shaking up the users focus.

How can I make this work and make my clients happy?

like image 984
Only Bolivian Here Avatar asked Nov 13 '22 22:11

Only Bolivian Here


1 Answers

private void datagridView1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
    {
        bindingsource.MoveNext();
    }
}
like image 172
Patrick Avatar answered Dec 05 '22 13:12

Patrick