Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automatic 'ENTER' to terminate

0 views
Skip to first unread message

GESI

unread,
May 17, 1997, 3:00:00 AM5/17/97
to

How can I set up text boxes etc. so that a user can press ENTER to
terminate an
entry rather than having to use the TAB or Mouse click.
The solution I need is not a coding solution (not checking KeyAscii=13, for

example) - but an automatic one, just as the TAB key is an automatic
function
inherent in VB forms.

Thanks.
Jorge Cotarelo

e-mail : grup...@statics.com.ar

Doug Marquardt

unread,
May 17, 1997, 3:00:00 AM5/17/97
to

Hi Jorge:

>>
The solution I need is not a coding solution (not checking KeyAscii=13, for

example) - but an automatic one
<<

Seeing as how you don't want a coding solution... I won't bother giving you
one
(but that is how you would have to do it).

>>
just as the TAB key is an automatic
function
inherent in VB forms.
<<

I take it then you want the enter key to behave like the tab key?
Well, I shouldn't... but here is a coding solution ;)

Sub Form_KeyPress(KeyAscii As Integer)
'Note: Form.KeyPreview = True
Select Case KeyAscii
Case vbKeyReturn
If TypeName(ctl) = "TextBox" Then
KeyAscii = 0
SendKeys "{TAB}"
End If
End Select
End Sub

Doug.


Doug.


Ibrahim Malluf

unread,
May 17, 1997, 3:00:00 AM5/17/97
to

Hello Jean

I would assume, that like me, he uses the Select Case method so that the
procedure is easily expanded to handle other cases. If you are building an
application with a user more acustomed to using keys rather than the mouse,
it is in this event that you would implement most of your keyboard
shortcuts. An If...Then quickly becomes a problem here :-)

--
Ibrahim Malluf
a MS Dev. MVP
_____________________
Malluf Consulting Services
http://www.malluf.com
iyma...@rt66.com
ibr...@malluf.com

Jean Claude NEERUNJUN <jcl...@bow.intnet.mu> wrote in article
<#000GruY...@uppssnewspub04.moswest.msn.net>...
> Just one question:
> If you have chosen to use "Select Case Keyascii" and not "If Keyascii =
",
> is it for performance reason or just a programming habit?
> Jean Claude
> Answer may also be posted to jcl...@bow.intnet.mu
> Doug Marquardt wrote in article
<01bc62c0$61717680$03e8c28e@dmarquardt>...

Ibrahim Malluf

unread,
May 17, 1997, 3:00:00 AM5/17/97
to

Now Doug :-), he said he didn't want a coding solution
--
Ibrahim Malluf
a MS Dev. MVP
_____________________
Malluf Consulting Services
http://www.malluf.com
iyma...@rt66.com
ibr...@malluf.com

Doug Marquardt <no_...@dummy.com> wrote in article

Doug Marquardt

unread,
May 17, 1997, 3:00:00 AM5/17/97
to

Hi Ibrahim:

>>
I would assume, that like me, he uses the Select Case method so that the
procedure is easily expanded to handle other cases.
<<

You are correct, sir! ;)

Doug.


0 new messages