By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,566 Members | 1,762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,566 IT Pros & Developers. It's quick & easy.

Enter instead of Tab

P: n/a
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?
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Keith Smith wrote:
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
Nov 16 '05 #2

P: n/a
I think you better use the SelectNextControl method instead of sending
another key.

Form.SelectNextControl(ActiveControl, true, true, true, true);

kind regards

Alexander

"MuZZy" <le*******@yahoo.com> wrote in message
news:9d********************@comcast.com...
Keith Smith wrote:
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

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.