Enter instead of Tab

  • Thread starter Thread starter Keith Smith
  • Start date Start date
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?
 
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
 
Back
Top