473,320 Members | 2,000 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,320 software developers and data experts.

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 5676
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***@bellsouth.net> wrote in message
news:ue**************@tk2msftngp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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***@bellsouth.net> wrote in message
news:ue**************@tk2msftngp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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_KeyPress( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
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****************@TK2MSFTNGP10.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***@bellsouth.net> wrote in message
news:ue**************@tk2msftngp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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.SelectNextControl(Me.ActiveControl, True, True, True, True)"

and it is working well.

If e.KeyChar = vbCr Then

e.Handled = True

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

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

I thought this is once provided by Armin Zingler,
\\\
Private Sub TextBox1_KeyPress( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
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****************@TK2MSFTNGP10.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***@bellsouth.net> wrote in message
news:ue**************@tk2msftngp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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_KeyPress( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
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****************@TK2MSFTNGP10.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***@bellsouth.net> wrote in message
news:ue**************@tk2msftngp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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.SelectNextControl(Me.ActiveControl, True, True, True, True)"

and it is working well.

If e.KeyChar = vbCr Then

e.Handled = True

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

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

I thought this is once provided by Armin Zingler,
\\\
Private Sub TextBox1_KeyPress( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
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****************@TK2MSFTNGP10.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***@bellsouth.net> wrote in message
news:ue**************@tk2msftngp13.phx.gbl...
Hi,
Set the forms keypreview property to true.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then

Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

End If

End Sub

Ken

-----------------
"Doug Bell" <dug@bigpond> wrote in message
news:eY***************@TK2MSFTNGP11.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
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...
1
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...
1
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....
0
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
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
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...
25
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...
3
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...
1
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.