Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access 2007/2010 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2010 (32 bit), 2007, 2003, 2002, 2000, and
Visual Basic 6.0!

Also available for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

 

 
Royalty free source code library modules for Microsoft Access, VB6, VBA, OfficeRoyalty free source code library modules for Microsoft Access, VB6, VBA, OfficeVBA and VB6 Source Code Library Download the free trial version of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA
Category: Microsoft Visual Basic 6 : Controls
Description: Code for working with VB6 controls

Class: CValidateControl

Class that provides the ability to perform validation on controls in their LostFocus events

Many people assume that it is easy to perform validation for VB controls in the LostFocus event. Actually this can be quite a problem. Consider the scenario where you have two text boxes, Text1 and Text2. Both have code in their LostFocus events which checks to see that valid data was entered. When the user tabs out of Text1, the LostFocus event fires, so the programmer displays a message box and attempts to set the focus back onto Text1. However before focus can be set to Text1, Text2 will receive a GotFocus event, and a LostFocus event. Unless the value in Text2 is already correct, the validation code in Text2 will fire, and the user will be stuck in an endless loop. This class keeps a state variable which tracks whether a validation test is currently being performed. If a validation routine for Text1 is being performed, Text2 will NOT fire its validation messages, even if the validation for Text2 fails.

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CValidateControl class
Validate Method Check truth value of validation test and handle focus events to avoid deadlock LostFocus code. This function is normally called in the LostFocus event of controls which you wish to modify.

Overview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence