Re: validating text boxes
You might take a look at the validate event (also the causesvalidation property).
Re: validating text boxes
Write your validation procedure not in the lost focus event, but separately. On the lost focus event call this procedure as well as on form unload event. If on the form unload event validation did not pass through, do not unload the form.
Iouri Boutchkine
[email protected]
Re: validating text boxes
When you click on a control(like a command button ao a text box), the control takes focus before the click event is executed there by firing the lostfocus event of the previous control and the gotfocus event of the current control.But it is an exception with the form.Even when you are closing the form the text box keeps the focus and hence the lostfocus event is not fired.So follow Louri's advice and use a separete procedure and call it in lostfocus event of the textbox as well as in the unload event of the form.
Re: validating text boxes
Thanks everyone - problem solved