|
-
Nov 15th, 1999, 03:33 PM
#1
Thread Starter
Hyperactive Member
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)
[email protected]
*******
-
Nov 15th, 1999, 07:11 PM
#2
Yep, you do, but there's a work around:
Code:
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
[email protected]
[email protected]
ICQ#: 51055819
-
Nov 15th, 1999, 07:42 PM
#3
Thread Starter
Hyperactive Member
-
Nov 15th, 1999, 09:13 PM
#4
The problem is that Serge's solution needs to be in KeyPress and not in KeyDown like so:
Code:
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).]
-
Nov 15th, 1999, 09:20 PM
#5
Thread Starter
Hyperactive Member
Thank you very much 
------------------
******
on error goto bed ;0)
[email protected]
*******
-
Nov 15th, 1999, 09:45 PM
#6
Member
Won't stop beeping?
KICK THE CRAZY THING!!!!!!!!!!
Sorry I couldn't resist 
Lloyd
-
Sep 2nd, 2000, 06:20 PM
#7
Junior Member
F&(*&#@ing beeping
That's great to finally find a workaround for that infernal beeping!!
-
Sep 2nd, 2000, 09:19 PM
#8
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.
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{TAB}"
KeyAscii = 0
End If
End Sub
Best regards
-
Sep 2nd, 2000, 09:39 PM
#9
Hyperactive Member
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.
-
Sep 2nd, 2000, 09:48 PM
#10
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.
-
Sep 2nd, 2000, 10:03 PM
#11
Hyperactive Member
LOL Just siding with you.. Not trying to take credit.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|