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!

need help with SetFocus 1

Status
Not open for further replies.

Judi201

Technical User
Jul 2, 2005
315
US
Hi All,

I know I have done this many times but can't seem to get this very simple thing right.

On a modal form I have 3 text boxes (among other things). The first is used to select a value to use to search for. From LostFocusEvent of this I show a MESSAGEBOX() saying key not found and want to return to the same textbox. I have SetFocus every way I can think of but the cursor always goes to the next tab stop. Tabs are set in the correct order if that makes any difference. VFP 6.0. How can I force the cursor back where it came from.

Sounds preschool to me but I can't get it.

Thanks for any suggestions.

Judi
 
Judi,

Try using the VALID() for your MESSSAGEBOX() instead of LOSTFOCUS() and do a RETURN 0 (zero) to prevent the focus from leaving the textbox. If you use RETURN .F., you can (or maybe always will?) get an error message saying "Invalid Input."

Teresa
 
Teresas,

Thanks so much. I know that I did not know that RETURN 0 would hold it in the same box. I was using LostFocus because I could not SetFocus from the Valid Event. Got it now tho!

Appreciate your response.

Judi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top