This happens in VFP 5.0 too.
I think the Valid event is kinda recursive too if you run a modal form within the event...I think maybe even if you run a modal form in the LostFocus event the Valid event is executed again....this is in 5.0. I forget all the details...I got the stuff working and I don't want to look back...
There is no easy/universal way of fixing this behaviour as far as I know...one workaround that I use is a custom property that is a logical that determines whether or not to run the Valid code...if it is false, the valid code just returns .T....and if it is true, the valid code sets it to false and run the valid code and sets it to true before returning...
Have fun,
Joe
>Why have Microsoft remove this function? In VFP3 it works just fine but in VFP6 I get an error message. I've used SetFocus a lot from When and Valid and now it couses me serious problems finding all the errors. But that wasn't really my question.
>From now on I don't use SetFocus from When and Valid Method but now I have run in to another problem. If When or Valid calls another form which then run a SetFocus in the "Init-sequence" then you also get the error message!?!? Why? This is VERY VERY annoing and i wounder if there is anyway to get around this? The error searching becomes so much harder if this is also a limit in VFP6.
>
>/Mårten Törnquist
Joseph C. Kempel
Systems Analyst/Programmer
JNC