Solved

KeyPress capture...

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio search word table and return Cell index 8 61
VB6 - Convert HH:MM into Decimal 8 56
MsgBox 4 62
Send outlook email from VBS Script 2 31
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

831 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