Results 1 to 5 of 5

Thread: how do i find out if user hits the enter key???

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    2

    Talking

    HOW DO I FIND OUT WHETHER USER HITS THE ENTER KEY???
    GETKEY?........
    KEYPRESS?......

    THANKS FOR THE HELP

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    You can check the KeyAscii value in the KeyPress event. Just check if KeyAscii = vbKeyReturn.

    Good luck!

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The Object_KeyPress event should do the trick. Check for vbKeyReturn or vbKeyEnter.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    Guest
    Do you want to know if it's pressed when your window has the focus? Or anywhere in windows?

  5. #5
    Guest
    If you want to detect the KeyPress regardless of which object has the focus, use the following code.
    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = vbKeyReturn Then MsgBox ("Enter was pressed")
    End Sub
    
    Private Sub Form_Load()
        Me.KeyPreview = True
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width