Home All Groups Group Topic Archive Search About

Make enter work like tab in forms

Author
10 Oct 2005 3:01 PM
Wylie C
I am trying to assign the enter key to work like the tab function on a visual
basic form. In other words, when the user hits the enter key they move from
one control to the next according to the tab order.

Author
10 Oct 2005 3:40 PM
Jeff Johnson [MVP: VB]
"Wylie C" <Wyl***@discussions.microsoft.com> wrote in message
news:0BE77F0D-6D05-4DC4-8DC9-DFD97E0E8A9D@microsoft.com...

>I am trying to assign the enter key to work like the tab function on a
>visual
> basic form. In other words, when the user hits the enter key they move
> from
> one control to the next according to the tab order.

This has been discussed several times in the past, so I recommend searching
this group on Google (http://www.google.com/advanced_group_search?hl=en) for
the keywords "enter tab data entry forward focus". I personally prefer the
SendKeys method, but there are other options and you should find discussions
on them all.
Author
10 Oct 2005 3:57 PM
MikeD
"Wylie C" <Wyl***@discussions.microsoft.com> wrote in message
news:0BE77F0D-6D05-4DC4-8DC9-DFD97E0E8A9D@microsoft.com...
>I am trying to assign the enter key to work like the tab function on a
>visual
> basic form. In other words, when the user hits the enter key they move
> from
> one control to the next according to the tab order.

You should only do this in special circumstances, and even then, it should
be optional and not the default.  It is extremely non-standard.  Users
accustomed to the standard usages of pressing Enter are going to be quite
confused if instead it moves focus from control to control.  IOW, provide it
as an option that users wanting this behavior can choose, but do NOT force
it on them.

Here's one way:

How To Make ENTER Key Move Focus Like TAB Key for VB Controls
http://support.microsoft.com/default.aspx?scid=kb;en-us;142816

There are probably other ways that are better (i.e. that do not use SendKeys
or require code in the KeyPress event of every control).

--
Mike
Microsoft MVP Visual Basic
Author
10 Oct 2005 4:28 PM
Mike Williams
"MikeD" <nob***@nowhere.edu> wrote in message
news:eFlaHNbzFHA.3892@TK2MSFTNGP12.phx.gbl...

> You should only do this in special circumstances, [make the
> Enter key move to the next control] and even then, it should be optional
> and not the default.  It is extremely non-standard.
> Users accustomed to the standard usages of pressing Enter
> are going to be quite confused

Actually (but then maybe I'm an oddity!) I am usually very annoyed at the
way pressing the Enter key "submits my request" on web pages and the like,
instead of moving on to the next text entry box (but then I'm probably just
"old fashioned"). I much prefer to be able to "fill in foms" by typing First
Name [enter], Surname [Enter], Address Line 1 [Enter] etc. It makes the
whole process very much easier and quicker, and that's how I write all of
the programs that I use for myself.

Mike
Author
11 Oct 2005 8:35 AM
J French
Show quote Hide quote
On Mon, 10 Oct 2005 11:57:31 -0400, "MikeD" <nob***@nowhere.edu>
wrote:

>
>"Wylie C" <Wyl***@discussions.microsoft.com> wrote in message
>news:0BE77F0D-6D05-4DC4-8DC9-DFD97E0E8A9D@microsoft.com...
>>I am trying to assign the enter key to work like the tab function on a
>>visual
>> basic form. In other words, when the user hits the enter key they move
>> from
>> one control to the next according to the tab order.
>
>You should only do this in special circumstances, and even then, it should
>be optional and not the default.  It is extremely non-standard.  Users
>accustomed to the standard usages of pressing Enter are going to be quite
>confused if instead it moves focus from control to control. 

MS write the 'standards'
- but they don't follow them - look at Excel

Most users I've met would get seriously upset if the Enter key did not
move between entry fields
Author
11 Oct 2005 1:47 PM
Jeff Johnson [MVP: VB]
Show quote Hide quote
"J French" <erew***@nowhere.uk> wrote in message
news:434b7831.262573040@news.btopenworld.com...

>>>I am trying to assign the enter key to work like the tab function on a
>>>visual
>>> basic form. In other words, when the user hits the enter key they move
>>> from
>>> one control to the next according to the tab order.
>>
>>You should only do this in special circumstances, and even then, it should
>>be optional and not the default.  It is extremely non-standard.  Users
>>accustomed to the standard usages of pressing Enter are going to be quite
>>confused if instead it moves focus from control to control.
>
> MS write the 'standards'
> - but they don't follow them - look at Excel
>
> Most users I've met would get seriously upset if the Enter key did not
> move between entry fields

....in a dedicated data entry application. (Spreadsheets and most grid-style
apps included.)

In a dialog box, though, no, no, no!
Author
12 Oct 2005 8:36 AM
J French
On Tue, 11 Oct 2005 09:47:40 -0400, "Jeff Johnson [MVP: VB]"
<i.get@enough.spam> wrote:

<snip>

>> Most users I've met would get seriously upset if the Enter key did not
>> move between entry fields

>...in a dedicated data entry application. (Spreadsheets and most grid-style
>apps included.)

>In a dialog box, though, no, no, no!

I think I rather agree
- provided it really is a Dialog Box, not a small data entry form