Solved

KeyPress capture...

Posted on 1998-04-24
3
373 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1428605
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
ID: 1428606
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
ID: 1428607
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 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