Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

The keyPress event  of a textbox not triggered when hit the TabKey

Posted on 2003-04-01
6
Medium Priority
?
356 Views
Last Modified: 2013-12-26
I want to type something in the textbox and hit the return key or tab key, then some action happen.
The return key works fine, but not with the tab key. Can you tell me why?


Private Sub txtFind_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn or KeyAscii = vbKeyTab Then
        sscmdFind.DoClick
     End If
     
End Sub
0
Comment
Question by:huhu
6 Comments
 

Expert Comment

by:simon780
ID: 8246096
It worked for me!!
0
 

Expert Comment

by:simon780
ID: 8246111
If it doesn't try "KeyAscii = 9" instead of "vbKeyTab"

Are you sure the textbox's name is txtFind????
0
 
LVL 11

Expert Comment

by:supunr
ID: 8249908
tab key does not trigger keypress event.  to do that you have to use KeyUp event.

Private sub text1_keyup(Keycode as integer, ...)
    if (Keycode = vbkeytab) then
       ' your code
    end if
End sub

' Good Luck!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Accepted Solution

by:
y2ksw earned 150 total points
ID: 8261160
vbkeytab refers to your keyboard's scancode. It might be different on different keyboards. KeyAscii = 9 would be the right choice. For the rest, supunr is right.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9053323
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in a week or two.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9117969
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept y2ksw's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question