General discussion

  • Creator
    Topic
  • #2080765

    VB6: Exit out of a text box’s Validation

    Locked

    by vdanner ·

    If a user has clicked on the New button, he will be taken to a data entry form. Most of the text boxes have simple validation’s in their respective Validation events, such as to make sure they have entered something in required fields. I want the user to be able to, at any time during entering a new record, to change their mind about entering a new record and hit the Cancel button, thereby clearing the form. But I can’t get the validation to end if they hit the Cancel button, even if I set CausesValidation = False in the cmdCancel_Click event. It is stuck in the Validation event and won’t move on to cmdCancel_Click unless the user enters some dummy data first.

All Comments

  • Author
    Replies
    • #3892058

      VB6: Exit out of a text box’s Validation

      by oliver w. ·

      In reply to VB6: Exit out of a text box’s Validation

      The best solution (and a very clean one too) is to validate the entries only on pressing Save/Ok.
      You just have to write a function to verify all fields and returning true if the entries are valid. If one isn’t valid, return the field name and senda message to the user to enter the proper values.
      Especially when users want to look up special entries in different locations it is annoying to get a NOT VALID message every time.
      Validating on OK/save_click is the best solution

      hope that helps
      Oliver

Viewing 0 reply threads