>>Hi Cetin,
>>
>>I'll have to disagree about putting this in LostFocus. Under some circumstances, it is possible for this to be bypassed. For example, assume that there's a command button that closes the form. If the user clicks on it and there's an invalid entry in the text box, the form closes. However, if this code is in the Valid, the user cannot click the command button.
>
>Yes, not a commandbutton but a toolbar might let it. OTOH valid is easily defeated when it's on a grid too. I prefer lostfocus because you can call other things easily ie: setfocus().
Hi Cetin,
I managed to get a command button on the form to do it (VPF 6.0 SP3). Your point about the grid is well taken. However, there's a school of thought (which I happen to subscribe to) that says it's not terribly wise to allow users to edit data directly in grid. So I don't generally use them for this purpose.
More than anything else, I think this is a matter of style. I just happen to belive that you validate the data in Valid, and use LostFocus to determine what happens next when appropriate. This also serves to enforce functional cohesion, so that's why I do it that why.
George
Ubi caritas et amor, deus ibi est