473,657 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use "Enter" to "Tab"

Hi,
I have just built a small application with a form that has one Text Box and
one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the User
hits the "Enter" button the focus will move to the next Tab item (i.e. the
Check Box). Likewise on the Check Box but obviously if a Command Button has
the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug
Nov 21 '05 #1
7 5711
Hi Ken,
Thanks
That does cause the "Enter" Key to tab but when it is pressed there is an
audible Ding! from the PC similar to an Error Warning Ding!

Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box and one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the User
hits the "Enter" button the focus will move to the next Tab item (i.e. the
Check Box). Likewise on the Check Box but obviously if a Command Button has the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug

Nov 21 '05 #2
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box and
one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the User
hits the "Enter" button the focus will move to the next Tab item (i.e. the
Check Box). Likewise on the Check Box but obviously if a Command Button has
the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug

Nov 21 '05 #3
Hi Ken,
Thanks
That does cause the "Enter" Key to tab but when it is pressed there is an
audible Ding! from the PC similar to an Error Warning Ding!

Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box and one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the User
hits the "Enter" button the focus will move to the next Tab item (i.e. the
Check Box). Likewise on the Check Box but obviously if a Command Button has the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug

Nov 21 '05 #4
Doug,

I thought this is once provided by Armin Zingler,
\\\
Private Sub TextBox1_KeyPre ss( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) _
Handles TextBox1.KeyPre ss
If e.KeyChar = vbCr Then
e.Handled = True
End If
End Sub
///

I hope thie helps?
Cor

"Doug Bell" <dug@bigpond> schreef in bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Ken,
Thanks
That does cause the "Enter" Key to tab but when it is pressed there is an
audible Ding! from the PC similar to an Error Warning Ding!

Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box

and
one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the
User
hits the "Enter" button the focus will move to the next Tab item (i.e.
the
Check Box). Likewise on the Check Box but obviously if a Command Button

has
the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and
I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug


Nov 21 '05 #5
Thanks Cor,

I added "
Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)"

and it is working well.

If e.KeyChar = vbCr Then

e.Handled = True

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

Doug
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:u1******** ******@TK2MSFTN GP10.phx.gbl...
Doug,

I thought this is once provided by Armin Zingler,
\\\
Private Sub TextBox1_KeyPre ss( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) _
Handles TextBox1.KeyPre ss
If e.KeyChar = vbCr Then
e.Handled = True
End If
End Sub
///

I hope thie helps?
Cor

"Doug Bell" <dug@bigpond> schreef in bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Ken,
Thanks
That does cause the "Enter" Key to tab but when it is pressed there is an audible Ding! from the PC similar to an Error Warning Ding!

Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box

and
one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the
User
hits the "Enter" button the focus will move to the next Tab item (i.e.
the
Check Box). Likewise on the Check Box but obviously if a Command Button

has
the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug



Nov 21 '05 #6
Doug,

I thought this is once provided by Armin Zingler,
\\\
Private Sub TextBox1_KeyPre ss( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) _
Handles TextBox1.KeyPre ss
If e.KeyChar = vbCr Then
e.Handled = True
End If
End Sub
///

I hope thie helps?
Cor

"Doug Bell" <dug@bigpond> schreef in bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Ken,
Thanks
That does cause the "Enter" Key to tab but when it is pressed there is an
audible Ding! from the PC similar to an Error Warning Ding!

Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box

and
one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the
User
hits the "Enter" button the focus will move to the next Tab item (i.e.
the
Check Box). Likewise on the Check Box but obviously if a Command Button

has
the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and
I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug


Nov 21 '05 #7
Thanks Cor,

I added "
Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)"

and it is working well.

If e.KeyChar = vbCr Then

e.Handled = True

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

Doug
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:u1******** ******@TK2MSFTN GP10.phx.gbl...
Doug,

I thought this is once provided by Armin Zingler,
\\\
Private Sub TextBox1_KeyPre ss( _
ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) _
Handles TextBox1.KeyPre ss
If e.KeyChar = vbCr Then
e.Handled = True
End If
End Sub
///

I hope thie helps?
Cor

"Doug Bell" <dug@bigpond> schreef in bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Ken,
Thanks
That does cause the "Enter" Key to tab but when it is pressed there is an audible Ding! from the PC similar to an Error Warning Ding!

Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ue******** ******@tk2msftn gp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextCo ntrol(Me.Active Control, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,
I have just built a small application with a form that has one Text Box

and
one Check Box and a couple of Command Buttons.

What I am trying to achieve is that if the Text Box has focus and the
User
hits the "Enter" button the focus will move to the next Tab item (i.e.
the
Check Box). Likewise on the Check Box but obviously if a Command Button

has
the focus, it will initiate the Click event

I have set the Forms CancelButton to the button that closes the form and I
have its AcceptButton set to none.

Do I have to trap every keystroke and test for "Enter"? Or is there a
property that I am missing?

Thanks

Doug



Nov 21 '05 #8

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

Similar topics

8
2818
by: EBG | last post by:
I have a simple email form on my site but getting screwy results because I know alot of users are hitting "enter" instead of tab when doing the form. When they hit enter the entire form is submitted whether it's finished or not. Is there an easy way to correct this? My site only cares about IE.
1
16298
by: Byron McClain | last post by:
.... is being consumed. I added an event handler for the "keypress" event and my delegate never gets executed. Why? I am trying to catch the "enter" key pressed event to prevent the DataGrid from going to currentRow + 1. Instead I want it to give focus to the next cell (currentCol + 1) to the right if not at the end of the row. Example:
1
2645
by: Dave McCloskey | last post by:
How can I convert the "Enter" key to a "Tab" so my application will act like "Tab" has been hit when the "Enter" key has actually been depressed. This gives type-writer functionality to programs. I was able to do this very simply in VB6, however, I have not found a method to do this in .NET. -- Take Care, Dave
0
1431
by: ad | last post by:
The user want to user "Enter" key to jump as "tab" do when editing data in a dataGrid. How can to do that?
5
2891
by: Lars Netzel | last post by:
Hey! I have tried...(in a datagrid) e.KeyDate.Return and e.KeyDate.TAB end e.KeyDate.Enter
1
366
by: Doug Bell | last post by:
Hi, I have just built a small application with a form that has one Text Box and one Check Box and a couple of Command Buttons. What I am trying to achieve is that if the Text Box has focus and the User hits the "Enter" button the focus will move to the next Tab item (i.e. the Check Box). Likewise on the Check Box but obviously if a Command Button has the focus, it will initiate the Click event I have set the Forms CancelButton to the...
25
11891
by: mdh | last post by:
I wrote a little insignificant program, to help me write a more significant one!!...that was supposed to print all Ascii values from 0 to 127: >>>> #include <stdio.h> # define UPPER_LIMT 127 int main (){
3
4166
by: aryayudhi | last post by:
I have a html page that has javascript that works perfectly in IE, but not in Firefox. The use of this javascript to change "Tab" to "Enter" Button. When we press Tab, it is like when we press Enter button. How to make this script can be run on Firefox? I would be grateful to anybody who can help me on this, as I have got out of my depth with this problem. Thanks, Arya ======== This is the script : <script language="javascript"...
1
2011
by: pippyn | last post by:
I'm programming for a CE device with reduced key board, no mouse, and no touch screen. As such, I have to tab from button to button to get the focus on the button i want. Then to invoke the button with focus i have to hit two keys on the key board to send a space in order to "click" the button. I want to just hit one key, the enter key, instead. So, how do i trap the enter and turn it into a space? I tried putting the following code in...
0
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.