Solved

KeyPress capture...

Posted on 1998-04-24
3
371 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

809 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