|
-
October 12th, 2001, 09:17 AM
#1
validating text boxes
Hi
I'm trying to validate data in a text box using the lost_focus event. This works except for the text box that has the focus when the form is closed. The lost focus event does not seem to run then. Can anyone tell me the best method for validating text boxes.
Thanks
Simon Dennis
-
October 12th, 2001, 09:47 AM
#2
Re: validating text boxes
You might take a look at the validate event (also the causesvalidation property).
-
October 12th, 2001, 01:37 PM
#3
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]
-
October 14th, 2001, 07:07 AM
#4
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.
-
October 15th, 2001, 09:11 AM
#5
Re: validating text boxes
Thanks everyone - problem solved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|