Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

Make 'Enter' do tab action.

Easy.  But I still can't figure out.  How to make enter key go through the tab order.
0
RUSTY
Asked:
RUSTY
  • 2
1 Solution
 
RUSTYAuthor Commented:
System won't let me edit question.  I'm using VB 5.0 Professional Edition.
0
 
traygreenCommented:
Set the KeyPreview to true on the form
On the key down event
   If KeyCode = 13 Then
      KeyCode = 0
      SendKeys "{TAB}"
   End If
0
 
traygreenCommented:
I added this comment to the bottom of your reposted question.  It works better than monkeying around with the button as recomended by caraf_g

The beeb is due to windows determiniting that they key pressed in the control is invalid.  This is triggered prior to the key press event being fired
The problem with the default button is that it eliminates the key_down event on the form and fires the buttons clicked event.

The work around is to set the multiline property for the controls to true and then move the code to the key_press event...

Private Sub Form_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
      KeyAscii = 0
      SendKeys "{TAB}"
   End If
End Sub

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now