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 7 5363
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
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
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
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
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
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
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
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
8 posts
views
Thread by EBG |
last post: by
|
1 post
views
Thread by Byron McClain |
last post: by
|
1 post
views
Thread by Dave McCloskey |
last post: by
|
reply
views
Thread by ad |
last post: by
|
5 posts
views
Thread by Lars Netzel |
last post: by
|
1 post
views
Thread by Doug Bell |
last post: by
|
25 posts
views
Thread by mdh |
last post: by
| | | | | | | | | | | | |