Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does Lost focus does not retain focus ?

Forms & Screen

Why does Lost focus does not retain focus ?

by  ramani  Posted    (Edited  )
Often, we use validation code in the LostFocus event instead of in Valid event of a control. There are many reasons to do this way.

What one often forget is that - the lost focus event does not retain focus by the evnt returning .t. or .f. (example.. RETURN .t. or RETURN .f.)

The code should follow the example given below:

myText1.LostFocusEvent
**********************
IF This.Value # myDesiredValue
MESSAGEBOX("Try again. Value not acceptable",16,"Stop")
NODEFAULT
ENDIF

The use of NODEFAULT tells the event not to loose the focus and retain it back.

**********************************************************
Ramani (Subramanian.G), FoxAcc, ramani_g@yahoo.com
**********************************************************
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top