Enter instead of Tab

K

Keith Smith

I would like to tab through fields by using the "Enter" key instead of the
"Tab" key.

I set the KeyPreview on my Form to True and then I used this code upon
Form_KeyUp

if (e.KeyCode==Keys.Enter)
{
SendKeys.Send("{tab}");
}

Is this a bad method?
 
M

MuZZy

Keith said:
I would like to tab through fields by using the "Enter" key instead of the
"Tab" key.

I set the KeyPreview on my Form to True and then I used this code upon
Form_KeyUp

if (e.KeyCode==Keys.Enter)
{
SendKeys.Send("{tab}");
}

Is this a bad method?

I don't see any cons, if it works - that's if you won't ever need [Enter] functionality for the form.
The only change i would suggest is to put it to Form_KeyDown instead of Form_KeyUp. That's how the
DOS interfaces usually worked with [Enter] being [Tab], same for the terminal console...

HIH,
Andrey
 

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