Click to See Complete Forum and Search --> : Computer wont stop "BEEP"
onerrorgoto
Nov 15th, 1999, 02:33 PM
I have a bunch of textboxes and lets the user press enter to jump to the next textbox in the form.
But when he hits enter the computer "beeps" as it jumps to the next textbox.
This is the code
Private Sub txtSendTo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
frmNetSend.txtMessage.SetFocus
End If
End Sub
This is the question
Why does the computer beep and how can I force it not to?
------------------
******
on error goto bed ;0)
anders@zsystemdesign.se
*******
Serge
Nov 15th, 1999, 06:11 PM
Yep, you do, but there's a work around:
Private Sub txtSendTo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
frmNetSend.txtMessage.SetFocus
KeyCode = 0
End If
End Sub
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
onerrorgoto
Nov 15th, 1999, 06:42 PM
Thank you :)
but why Keycode=0 ?
And I'm sorry but it doesn't work on my machine. the computer beeps when it jumps to the next textbox :(
------------------
******
on error goto bed ;0)
anders@zsystemdesign.se
*******
[This message has been edited by onerrorgoto (edited 11-16-1999).]
MartinLiss
Nov 15th, 1999, 08:13 PM
The problem is that Serge's solution needs to be in KeyPress and not in KeyDown like so:
Private Sub txtSendTo_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
txtmessage.SetFocus
End If
End Sub
And the KeyCode = 0 is there to "eat" the keystroke if it's vbKeyReturn. It's a common way to force user to enter a certian (usually small) set of values.
------------------
Marty
[This message has been edited by MartinLiss (edited 11-16-1999).]
onerrorgoto
Nov 15th, 1999, 08:20 PM
Thank you very much :)
------------------
******
on error goto bed ;0)
anders@zsystemdesign.se
*******
Lloyd
Nov 15th, 1999, 08:45 PM
Won't stop beeping?
KICK THE CRAZY THING!!!!!!!!!!
Sorry I couldn't resist :(
Lloyd
Merlyn27
Sep 2nd, 2000, 06:20 PM
That's great to finally find a workaround for that infernal beeping!!
Joacim Andersson
Sep 2nd, 2000, 09:19 PM
You might want to consider using SendKeys in the procedure to make it more general.
Because you can then use the same code for all the textboxes and you don't have to change the code if you change the TabOrder of the controls.
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{TAB}"
KeyAscii = 0
End If
End Sub
Best regards
Steve Stunning
Sep 2nd, 2000, 09:39 PM
I would use the
SendKeys "{TAB}" vs frmNetSend.txtMessage.SetFocus
That way you can keep control of what is next with the tab setting instead of having to change your code in case you needed to move or add things later on.
Joacim Andersson
Sep 2nd, 2000, 09:48 PM
Originally posted by Steve Stunning
I would use the
SendKeys "{TAB}" vs frmNetSend.txtMessage.SetFocus
That way you can keep control of what is next with the tab setting instead of having to change your code in case you needed to move or add things later on.
Yup, that is just what I said in my previous post.
Steve Stunning
Sep 2nd, 2000, 10:03 PM
LOL Just siding with you.. Not trying to take credit. :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.