>I have seen some interesting code lately where instead of code in the valid method; the programmer is using lost focus.
>
>What are the advantages/disadvantages of such methodology? What is preferred? Why?
>
>Thanks
>
>Ric
Ric,
IMHO FWIW use lostfocus instead of valid wherever possible.
With valid :
-You're still in the object being validated. That means any code called to move context to another object would be an headache sooner or later (ie: if custID is wrong and you popup another form to get ID)
-No code (either directly in valid or any code called from there) could have a setfocus in it.
-Valid in a grid doesn't mean it'd work all the time - based on version
-Messages are controlled mostly by system not you.
With lostfocus :
-You have control either to stay in control or not
-You can freely call other objects such as forms
-You can setfocus
-You decide about messages
Cetin