473,396 Members | 2,109 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.

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 5687
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.