|
-
Apr 16th, 2002, 10:41 AM
#1
Form Validation
does anyone have an example of using form validation??? i always just create a function that checks all my forms controls how i need them to be checked... but i was looking at the CausesValidation property of controls and the form has a ValidateControls method... so how do you impliment all of this? I don't know if I am going to use it, but I would at least like to know how.
-
Apr 16th, 2002, 11:18 AM
#2
When you move the input focus from one constituent control of a UserControl module to another constituent control, the Validate control of the former control fires as expected. However, if you move from a constituent control to another control directly placed over the host form, the Validate event doens't fire immediately. Instead, it will fire only when the UserControl gets the focus again.
The simplest workaround for this bug is to invoke the ValidateControls method from within the UserControl_ExitFocus. Another option is to call the form's ValidateControls method from within the UserControl's LostFocus event in the parent form. However, if you do so the LostFocus event for the constituent control will fire after the LostFocus event of the UserControl, which is the reverse of the regular behavior.
So basically, it's to fire the validate event for the last used control on the form, right before the user leaves the form.
(vb2themax.com)
-
Apr 16th, 2002, 01:13 PM
#3
I think i like having it all in 1 routine.. i hate forms the message box you after you leave the focus of every field to tell you you did something wrong.
-
Apr 16th, 2002, 01:37 PM
#4
That's exactly how I do it. I was unaware of it's existence until your post showed up.
A single function verifyform() would be much more efficient.
Based upon the boolean returned from this, I proceed with the transactions.
apparently, our coding is similar, but the flash differences remain
-
Apr 16th, 2002, 01:54 PM
#5
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
|