Hi Nadya:
The flag doesnt work because the valid fires before the queryunload :((
Thanks
------------
>When you click on x in right corner, form QueryUnload method fires. You can >set some flag there and check for this flag in Valid method. Also you would >probably have to add DoEvents() in Valid method, though I'm not sure, it's >allowed. Could you please try these suggestions and let me know your results.
------------
>Thanks James!
>I need this for a textbox...
>I have a validation code in the valid method who detect negative values, and the users dont want this if there are closing the form, but one time the textbox have the focus i cant do anything to stop it.
>-------------------------
>>Hello
>>Does anybody know if there are any way to intercept the valid method?
>>i need do this in the case the user click the cross in the upper right corner of the window, and i dont want to run the code in the valid because he wants to exit...
>>Sorry about my poor english!
Ariel Gimenez
our power is our knowledge