Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setfocus problem
Message
 
To
12/04/2007 03:19:18
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01214849
Message ID:
01214850
Views:
8
This message has been marked as the solution to the initial question of the thread.
>Hi,
>I want to control user to enter client code in a editbox and not allow enter a blank client code, if user enter a blank field, an warning message will display and setfocus to the editbox, I put the checking code in the Lostfocus event of the editbox, the code as follow:-
>
>SET EXACT ON
>IF SEEK(ALLTRIM(thisform.txtCusno.Value),"CUSMAS")
>   thisform.txtCusname.Value = cusmas->cusname
>ELSE
>	IF EMPTY(thisform.txtCusno.Value)
>		MESSAGEBOX("You must enter client code!",48,"Warning")
>	ELSE
>		MESSAGEBOX("Client code not exist!",48,"Warning")
>	ENDIF
>   	thisform.txtCusname.Value = " "
>	thisform.txtCusno.SetFocus()
>ENDIF
>
>
>When user press TAB to bypass the input, I find that thisform.txtCusno.SetFocus() does not work. I try to put this checking into the VALID event, but the VALID event does not allow the setfocus statement.
>How could I do? please suggest.
>
>Thanks
>
>Derek Yim

Try:
SET EXACT ON
IF SEEK(ALLTRIM(thisform.txtCusno.Value),"CUSMAS")
   thisform.txtCusname.Value = cusmas->cusname
ELSE
	IF EMPTY(thisform.txtCusno.Value)
		MESSAGEBOX("You must enter client code!",48,"Warning")
	ELSE
		MESSAGEBOX("Client code not exist!",48,"Warning")
	ENDIF
   	thisform.txtCusname.Value = " "
	thisform.txtCusno.SetFocus()
        NODEFAULT
        RETURN
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform