Solved

Capture text box LostFocus

Posted on 1997-03-13
1
274 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
[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
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

726 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