Solved

Capture text box LostFocus

Posted on 1997-03-13
1
270 Views
Last Modified: 2012-08-13
I use Crescent text box controls in 16-bit VB 4.0.  I have some code behind the text boxes' LostFocus event that need to be executed (mostly data validation).  However, when I click on one of the menu itmes in MDIOnline form, the LostFocus event of currently selected text box did not get triggered.  I tried to use SendKeys "{Tab}" in menu item click event, but the LostFocus event still did not get fired.  Can somebody provide me with a pointer?  Thanks in advance.
0
Comment
Question by:Copland
1 Comment
 
LVL 5

Accepted Solution

by:
volking earned 100 total points
ID: 1424475
First, you're never going to get the lost focus event to fire. I encounter the same problem about 10 months ago and spent almost 2 days chasing it.

My best advice is

1) move ALL validation code from ALL controls to a central SUB.

2) in each control's GotFocus event, set a global variable (of type control) to whatever control just got the focus.

3) In each control's Lost focus event, call the central sub.

Now here's the tricky part ... Since you're using Crescent's QuickPac controls (by the way I LOVE THOSE CONTROLS!) anyways, QuickPak has a control called CSForm. When you add CSForm to a form, you get a bunch of new events. The two events you're interested in are MenuBrowse and SysMenuClick.

In those two events, you also fire the Centralized SUB.

You may also want to take a look at the CtlNotify event. I played with it a bit, but to be honest, the danged thing fired too much, especially in an MDI environment.

Good luck.
============> Frederick


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

930 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