Validate and enable event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mangemukesh
    New Member
    • Dec 2006
    • 1

    #1

    Validate and enable event

    Hi

    When I am Enable or desable any control, at that time its validate event is fires
    what to do to stop validate event?
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by mangemukesh
    When I am Enable or desable any control, at that time its validate event is fires
    what to do to stop validate event?
    What version of VB are you using?

    Comment

    • aaryan
      New Member
      • Nov 2006
      • 82

      #3
      Originally posted by Killer42
      What version of VB are you using?
      hi,
      set the causes validation property of the control to false.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by aaryan
        hi,
        set the causes validation property of the control to false.
        But only if you never want it to cause validation. If that's not the case, you may have to work around it. A couple of ideas:
        • Create a SetControlActiv e Sub and invoke it instead of setting Enabled directly. In the Sub:
          - Turn off "causes validation"
          - Enable or disable (perhaps depending on a parameter)
          - Turn on "causes validation"
        • Create a form-level flag to indicate "don't validate at the moment". In any of the validation routines, check the flag and exit if it is set. That will allow you to turn the validation for everything on/off as desired.
        • You could go further and create such a flag for each control, but that would just be duplicating the "causes validation" property, so would be a waste of time.

        Comment

        Working...