473,396 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Enter Key

How do I set the enter key to move from one field to the
next field?
Nov 20 '05 #1
11 4765
ugly sollution but it works (there are probably some ppl that want to kill
me for this ;p) if there are better wayslet me know

create a button set its border attributes so you can't c them and if you
want hide it behind another controll. Set the button as the acceptbutton of
the form and put code like this behind it.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click

Select Case True

Case cboLijn.Focused

txtBegMeter.Focus()

txtBegMeter.SelectAll()

Case txtBegMeter.Focused

bevestigLijn()

Case cboProduct.Focused

txtColli.Focus()

txtColli.SelectAll()

Case txtColli.Focused

cboSchaal.Focus()

cboSchaal.SelectAll()

Case Else

End Select

End Sub
"Claudie Bouzy" <cd*****@hotmail.com> wrote in message
news:2c*****************************@phx.gbl...
How do I set the enter key to move from one field to the
next field?

Nov 20 '05 #2
Turn "KeyPreview ON" for the form before your try this code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then
If Not ActiveControl Is Nothing Then
SendKeys.Send("{TAB}")
End If
End If

End Sub
Nov 20 '05 #3
* "Claudie Bouzy" <cd*****@hotmail.com> scripsit:
How do I set the enter key to move from one field to the
next field?


You don't need to post more than once.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
this looks a lot better :)
do you know how to include a shift w that (for example shift+tab) ?

eric
"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:ex**************@TK2MSFTNGP10.phx.gbl...
Turn "KeyPreview ON" for the form before your try this code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then
If Not ActiveControl Is Nothing Then
SendKeys.Send("{TAB}")
End If
End If

End Sub

Nov 20 '05 #5
To give Claudie the benefit, the servers have been a little slow, perhaps
they grew impatient when it hadn't appeared on the group, so firgured they
probably didn't send it right, or it got lost etc.... so posted again.

caused enough discussion. ;o)

Dan.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bm************@ID-208219.news.uni-berlin.de...
* "Claudie Bouzy" <cd*****@hotmail.com> scripsit:
How do I set the enter key to move from one field to the
next field?


You don't need to post more than once.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
I'm not all that sure with VB, (still getting my head around what it can,
and more importantly, can't allow you to do! ;o) ), but with C++ you can do
the same thing, but have another "if" test to check if the shift key is
currently down.

So you'd need some sort of

If ShiftIsDown And Keypress was W

type thing...

"EricJ" <ericRéMo**@ThiSomnipack.be> wrote in message
news:3f**********************@reader0.news.skynet. be...
this looks a lot better :)
do you know how to include a shift w that (for example shift+tab) ?

eric
"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:ex**************@TK2MSFTNGP10.phx.gbl...
Turn "KeyPreview ON" for the form before your try this code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then
If Not ActiveControl Is Nothing Then
SendKeys.Send("{TAB}")
End If
End If

End Sub


Nov 20 '05 #7
sorry i meanth in the sending part

like if you press insert the sub sends shift+tab to the form so the previous
control is selected

but this is sertainly usefull 2

"Daniel Bass" <I'm really @ sick of spam> wrote in message
news:eT**************@TK2MSFTNGP11.phx.gbl...
I'm not all that sure with VB, (still getting my head around what it can,
and more importantly, can't allow you to do! ;o) ), but with C++ you can do the same thing, but have another "if" test to check if the shift key is
currently down.

So you'd need some sort of

If ShiftIsDown And Keypress was W

type thing...

"EricJ" <ericRéMo**@ThiSomnipack.be> wrote in message
news:3f**********************@reader0.news.skynet. be...
this looks a lot better :)
do you know how to include a shift w that (for example shift+tab) ?

eric
"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:ex**************@TK2MSFTNGP10.phx.gbl...
Turn "KeyPreview ON" for the form before your try this code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then
If Not ActiveControl Is Nothing Then
SendKeys.Send("{TAB}")
End If
End If

End Sub


Nov 20 '05 #8
Hi Eric,

Here's the full list.
http://msdn.microsoft.com/library/de.../cpref/html/fr
lrfsystemwindowsformssendkeysclasstopic.asp

Regards,
Fergus
Nov 20 '05 #9
tnx :)

i should have asked claudies question a few months ago instead of working
out my own hidden enter button ;p

eric

"Fergus Cooney" <fi******@tesco.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Eric,

Here's the full list.
http://msdn.microsoft.com/library/de.../cpref/html/fr lrfsystemwindowsformssendkeysclasstopic.asp

Regards,
Fergus

Nov 20 '05 #10
* "Daniel Bass" <I'm really @ sick of spam> scripsit:
To give Claudie the benefit, the servers have been a little slow, perhaps
they grew impatient when it hadn't appeared on the group, so firgured they
probably didn't send it right, or it got lost etc.... so posted again.


Now the servers seem to be incredibly fast.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #11
They do over the last week, which is great! =o)

Sick of that spam, who ever writes it, but perhaps more importantly, who in
the hell ever responds to it to make it worth their while sending it in the
first place?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bm************@ID-208219.news.uni-berlin.de...
* "Daniel Bass" <I'm really @ sick of spam> scripsit:
To give Claudie the benefit, the servers have been a little slow, perhaps
they grew impatient when it hadn't appeared on the group, so firgured they
probably didn't send it right, or it got lost etc.... so posted again.


Now the servers seem to be incredibly fast.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: junk mail | last post by:
My friend is trying to code a small c program where he wants to force the user to press enter and only enter to continue. Currently he is using getchar() with a loop but you can type any number...
5
by: ewillyb | last post by:
Hi, ASP.NET has some interesting behavior when the user hits the Enter key. If there are multiple ASP:Buttons (rendered as HTML submits) on the form, when the user hits enter, the first button's...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
6
by: Clark Sann | last post by:
Can someone help me understand what object should be used as the lock object? I've seen some programs that use Monitor.Enter(Me). Then, in those same programs, they sometimes use another object. ...
7
by: Marc | last post by:
Hi, I want my user to be able to rename a button control by selcting rename from a menu. This then opens a text box in which to enter the new name in. I want the button control to...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
2
by: JWest46088 | last post by:
I want the user to enter information, such as names, and then I want to ask them after they entered the first name if they want to enter another name. How would I do that? This is what I have so...
7
by: Rotsey | last post by:
Hi, I am having a problem trying to select an item with the enter key. I want to work the combo with the keyboard. So when I use the down arrow to browse the list I want to then hit the...
24
by: MichaelK | last post by:
Who knows how to prevent submitting a form on the press Enter button before all fields on the form are filled up. People just enter the first field hit Enter and it submits the form and doing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.