473,549 Members | 2,670 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 5702
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
2815
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
16276
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. ...
1
2641
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
1425
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
2883
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...
25
11871
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
4163
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...
1
2006
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,...
0
7521
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7720
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. ...
0
7959
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7473
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5088
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...
0
3501
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...
1
1944
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
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.