Results 1 to 10 of 10

Thread: Detecting key pressed

  1. #1

    Thread Starter
    New Member
    Join Date
    May 1999
    Location
    Toronto,Ontario,Canada
    Posts
    14

    Post

    Does anyone know how to detect if the "Enter" key is pressed? Please, include some code please. Thanks!!

    ------------------

  2. #2
    New Member
    Join Date
    Feb 1999
    Posts
    10

    Post

    try this:

    Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then MsgBox "You pressed enter!"
    End Sub

  3. #3
    Lively Member
    Join Date
    Jun 1999
    Location
    East Anglia, England
    Posts
    73

    Post

    Try this

    Private Sub TextBox1_KeyUp(KeyCode As Integer)

    if keycode = vbreturn then
    'DO THE THING
    end if

    End Sub

  4. #4
    Guest

    Post

    How can I track which keys are pressed whether they are in my application or not?

  5. #5

    Thread Starter
    New Member
    Join Date
    May 1999
    Location
    Toronto,Ontario,Canada
    Posts
    14

    Post

    Actually, I have a text box for the user to enter something and I want to execute a function when the user press "return" after he/she is finished entering something in the text box. How do you do that?

    ------------------

  6. #6
    Addicted Member Stick's Avatar
    Join Date
    Aug 1999
    Location
    Iowa
    Posts
    152

    Post

    make that key a HOT KEY IN Windows I Should Work Instead of haveing the hot key open the app make it Record the key

  7. #7
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    VirtuallyVB..

    You can use the GetAsyncKeyState API, (I'm getting DejaVu I've Mentioned this API so much today...), eg.
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    
    Private Sub Timer1_Timer()
        If GetAsyncKeyState(vbKeyA) Then MsgBox "You Pressed 'A'"
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  8. #8
    Guest

    Post

    Aaron I have a Logitech Internet Keyboard and I HATE IT. I can't assign any events to the keys on the side of the keyboard. Do you have any ideas on finding out how to get their states? I am trying to make a program that uses them for macros!

    Please reply to my email address [email protected]

    I really looking forward to a reply

    ------------------
    ALF
    ALFWare


    [This message has been edited by ALFWare (edited 12-29-1999).]

  9. #9
    Guest

    Post

    I have a Logitech Internet Keyboard and I HATE IT. I can't assign any events to the keys on the side of the keyboard. Do you have any ideas on finding out how to get their states? I am trying to make a program that uses them extra things

    The keyboard has like 18 Extra keys on it and also a LED! It would be great if I could even find a API call that would cause a event on a key press so I could find the HEX address of that key!

    Please reply to my email address [email protected]

    I really looking forward to a reply

    p.s Did this to get it back up top! Sorry for any inconvience!

    ------------------
    ALF
    ALFWare



  10. #10
    Guest

    Post

    I really need help with this one so I am posting another message to take this one to hte top of the board sorries!

    The keyboard has like 18 Extra keys on it and also a LED! It would be great if I could even find a API call that would cause a event on a key press so I could find the HEX address of that key!

    Thanks again!



    ------------------

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