Solved

Capture text box LostFocus

Posted on 1997-03-13
1
269 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

772 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

13 Experts available now in Live!

Get 1:1 Help Now