Results 1 to 6 of 6

Thread: keycode

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Location
    Jerusalem
    Posts
    39

    keycode

    hi,

    is there a function that returns the keycode ?

    thank you in advance

  2. #2

  3. #3
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: keycode

    KeyDown and KeyUp events. For example (the KeyDown):
    Code:
    Private Sub txtText1_KeyDown(KeyCode As Integer, Shift As Integer)
        Debug.Print KeyCode
    End Sub

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2006
    Location
    Jerusalem
    Posts
    39

    Re: keycode

    thank you .

    I know it is used in the keydown event.. but i want to use it separately . KEYDOWN and KEYUP takes the character typed on the keyboard and gives its keycode I want a function or method that takes the character and returns the keycode ..

    for example keypress takes the KEYASCII as a parameter , but also we can use the AscW(character) as a separate method

    thanx

  5. #5
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: keycode

    KEYDOWN and KEYUP don't take the character that was typed. KeyCode is an indication of the keyboard key that was pressed.

    what do you expect your function to take as characters don't map to keycodes?

    also, why do you want to do this?

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: keycode

    Do you mean
    vb Code:
    1. Dim iCode As Integer
    2. iCode = Asc(sChar)

    Asc is a function, not a method.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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