Solved

KeyPress capture...

Posted on 1998-04-24
3
368 Views
Last Modified: 2008-02-20
In VB5, on an MDIChild form with a DBGrid on it, I want to be able to "zoom" to a name in the list displayed in the grid as the user types in a name.  The trouble is that even though I wrote a KeyPressed event handler for the grid, it is never accessed by the program.  I tried writing the event handler for the form (setting its Key Preview property to True, of course), but to no avail.  This REALLY confuses me!   Why won't the KeyPressed event trigger when the KeyUp/KeyDown events do?!?!

FWIW- the DBGrid is the one that distributes with VB5Pro, I'm not doing anything fancy thus far.

Please help, this has brought me to a stand-still!

 Jim 8^)
0
Comment
Question by:Raven1155
3 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
Comment Utility
It works for me. You probably did't install Service Pack 3.
That problem exist if you don't have SP3.
Get it from Microsoft Site and the problem will be solved.
0
 

Author Comment

by:Raven1155
Comment Utility
You may subclass the form window. Thus you will have a chance to proceed keypress events before DBGrid. Please refer to 'subclass' of VB Online (Passing function pointers...). If you have problems post a comment.
Regards
0
 
LVL 2

Accepted Solution

by:
marti earned 110 total points
Comment Utility
I read about "Subclass"-ing in VBOnline, as you suggested, and am flabbergasted that this seems like the "simple" solution to you (or to anyone)!  You're telling me that a programmer can't capture events that affect controls in their program directly.

I switched from Delphi to VB5 because I wanted to get "in to" the so-called industry standard.  In Delphi, overriding an event handler for a control was super-easy.  I find it hard to believe that VB is SO much less programmer-friendly.  The VB programmer seems stuck with "you have to accept what Microsoft lets you do" and "well, you can get that capability... by BUYING our fancy component".

If you feel that my grade is unfair because the problem is in VB and not yours, you are quite likely right, but I think it's ridiculous that I can't even tell if a key is pressed without making subclasses and stuff like that!!!

PS- I wonder why the last two answers to this question did NOT generate email notifications!  When I used Experts Exchange before (asking Delphi questions), I got notified right away that an answer had been posted!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now