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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CANNOT MAKE THE TEXTBOX VALIDATE EVENT WORK

Status
Not open for further replies.

TNN

Programmer
Sep 13, 2000
417
US
From an error handler I am trying to pass an argument to a textbox validate event to keep the texbox from losing the Focus. The error occurs after the LostFocus event of the 1st textbox, then I trap the error and want to prevent the 2nd textbox from receiving the Focus and retain Focus at the 1st textbox.

CausesValidation property is true for both text boxes.
The txt1_Validate event does receive the arguments of Index and True but Focus moves to the 2nd textbox.

I'm Stumped. This is first time I've tried to use the validate event. Am I doing something wrong????

My code is as follows:

Handlerr:
Select Case -2147217887
case Err.Number
txt1_Validate Index, True
End Select

Sub for textbox:

Sub txt1_Validate(Index as integer, Cancel as Boolean)

End Sub

Help is appreciated.
TNN, Tom
TNPAYROLL@AOL.COM




TOM
 
The validate event happens automatically on lost focus (I think) of the text box. Check in the event _Validate of the text box for whatever, and then set the value of Cancel to True or False, depending on whether your check was successful or not.

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top