>I,m using a LostFocus Event of a TextBox to test to see if the data entry is valid. If it is not valid I pop up a MessageBox then setFocus back to the original TextBox. It's not working. The focus goes to where it would have gone had I not tried to capture it.
>
>Seek AllTrim(ThisForm.txtTypeCode.Value)
>If Not Found()
> MessageBox("Invaild Entry")
> ThisForm.txtTypeCode.SetFocus
>Else
> ThisForm.txtTypeDesc.Value=Type2.Desc
>EndIf
>Thisform.Refresh
>
>Any help?
>
>Thanks
The Valid event is probably a better place to do this kind of validation. After displaying your MESSAGEBOX(), you can RETURN 0 and the cursor will remain in the field.
If you insist on using the LostFocus event you will have to add the NODEFAULT command to keep VFP from setting focus to the next control in the Tab list.
Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.