?
Solved

KeyPress capture...

Posted on 1998-04-24
3
Medium Priority
?
374 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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

752 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