process a keystroke - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

process a keystroke

Does anyone know how to process a keystroke when entering it in a standard VB6 textbox? Right now it just jump to next tabstop. What I wish to do is to catch it just like a keystroke;
___________________________________________________________
Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
If keyascii = 13 Then
___________________________________________________________

How would it look for a catch? I found out that there should be a textbox with a "AcceptsTab" property... but I can't find it. All input is highly appreciated.

Thanks in advance.

Best Regards,

Lars Thornqvist

Comments

  • HackmanCHackmanC Posts: 441Member
    The KeyAscii for TAB is 9. Look for in the old ASCII Charts in very old books. lol.

    Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
    If keyascii = 9 Then
    ' Use it and ...
    keyascii = 0
    End If


    -------
    : Does anyone know how to process a keystroke when entering it in a standard VB6 textbox? Right now it just jump to next tabstop. What I wish to do is to catch it just like a keystroke;
    : ___________________________________________________________
    : Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
    : If keyascii = 13 Then
    : ___________________________________________________________
    :
    : How would it look for a catch? I found out that there should be a textbox with a "AcceptsTab" property... but I can't find it. All input is highly appreciated.
    :
    : Thanks in advance.
    :
    : Best Regards,
    :
    : Lars Thornqvist
    :
    :

    [red]Good luck![/red]
    [blue]Hackman[/blue]

  • lars.thornqvislars.thornqvis Posts: 4Member
    Thanks for your reply dude.

    My problem is however that windows seem to handle the at a higher level so that I never get a chance to catch it. When pressing the it never trigg the "KeyPress" event.

    Any other ide?

    Thanks in advance.



    : The KeyAscii for TAB is 9. Look for in the old ASCII Charts in very old books. lol.
    :
    : Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
    : If keyascii = 9 Then
    : ' Use it and ...
    : keyascii = 0
    : End If
    :
    :
    : -------
    : : Does anyone know how to process a keystroke when entering it in a standard VB6 textbox? Right now it just jump to next tabstop. What I wish to do is to catch it just like a keystroke;
    : : ___________________________________________________________
    : : Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
    : : If keyascii = 13 Then
    : : ___________________________________________________________
    : :
    : : How would it look for a catch? I found out that there should be a textbox with a "AcceptsTab" property... but I can't find it. All input is highly appreciated.
    : :
    : : Thanks in advance.
    : :
    : : Best Regards,
    : :
    : : Lars Thornqvist
    : :
    : :
    :
    : [red]Good luck![/red]
    : [blue]Hackman[/blue]
    :
    :



  • dokken2dokken2 Posts: 532Member
    : Thanks for your reply dude.
    :
    : My problem is however that windows seem to handle the at a higher level so that I never get a chance to catch it. When pressing the it never trigg the "KeyPress" event.
    :
    : Any other ide?
    :
    : Thanks in advance.
    :
    :
    :

    Use the KeyDown event, for example with a Textbox:
    [and there are constants for the keycodes]

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = Asc(vbTab) Then MsgBox "Tab =" & KeyCode, , "keydown"
    End Sub
Sign In or Register to comment.