>Hi,
>
>I have a problem, which is when i have a form open i can click on to the 'X' button of the form in the top right hand corner. the problem is when the form closes the valid event of the textbox i am on is run. is there any way i can stop the valid and lostfocus events from running when the 'X' button is clicked or even when a command button is clicked?
>
Why?
If you need to do this, I suspect you are using the valid event wrong.
If what you need to is to validate input except when the user click the escape button, then you can have your validation code look like:
IF LASTKEY() <> 27
* validation code here
ENDIF
Just make sure that the Cancel property of your escape or cancel button is .T., and VFP automagically sets LASTKEY() to the escape code when it is clicked.
Erik Moore
Clientelligence