Results 1 to 5 of 5

Thread: Form Validation

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    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)

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    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.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    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

  5. #5

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by mendhak
    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
    thats ok.. on here i guess our coding practices are more importaint than our taste in flash movies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width