Results 1 to 5 of 5

Thread: Ascii nr for ENTER

  1. #1
    Guest

    Talking

    Can you tell me wich is the ascii code for the enter button please and can you tell me also if this code is correct:

    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
        If KeyAscii = 28 Then
            Command1_Click
        End If
    End Sub
    numibesi

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If you set the form's KeyPreview property to true, then that's fine. Also, I would suggest using the constant vbKeyEnter rather than a number.
    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

  3. #3
    Guest
    Change 28 to 13, which is the Ascii for Enter/Return
    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
        If KeyAscii = 28 Then
            Call Command1_Click
        End If
    End Sub

  4. #4
    Guest

    Angry It doesn´t work

    It doesn´t work, it could be probabli because the 28 isn´r the nr for the enter button on ascii code.

  5. #5
    Guest

    Sorry Megatron

    Thank you megatron, but i was looking for other threads and i found that i could use vbKeyReturn insted of vbKeyEnter that doesn´t work.

    Thank you both, numibesi


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