Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18013
Number of posts: 55386

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
process a <TAB> keystroke Posted by lars.thornqvis on 22 Feb 2005 at 1:49 AM
Does anyone know how to process a <TAB> 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 <ENTER> keystroke;
___________________________________________________________
Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
If keyascii = 13 Then
___________________________________________________________

How would it look for a <TAB> 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

Report
Re: process a <TAB> keystroke Posted by HackmanC on 22 Feb 2005 at 10:59 AM
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 <TAB> 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 <ENTER> keystroke;
: ___________________________________________________________
: Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
: If keyascii = 13 Then
: ___________________________________________________________
:
: How would it look for a <TAB> 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
:
:

Good luck!
Hackman

Report
Re: process a <TAB> keystroke Posted by lars.thornqvis on 23 Feb 2005 at 12:10 AM
Thanks for your reply dude.

My problem is however that windows seem to handle the <TAB> at a higher level so that I never get a chance to catch it. When pressing the <TAB> 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 <TAB> 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 <ENTER> keystroke;
: : ___________________________________________________________
: : Private Sub AE_SerialNo_KeyPress(keyascii As Integer)
: : If keyascii = 13 Then
: : ___________________________________________________________
: :
: : How would it look for a <TAB> 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
: :
: :
:
: Good luck!
: Hackman
:
:



Report
Re: process a <TAB> keystroke Posted by dokken2 on 23 Feb 2005 at 5:37 AM
: Thanks for your reply dude.
:
: My problem is however that windows seem to handle the <TAB> at a higher level so that I never get a chance to catch it. When pressing the <TAB> 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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.