How do I check all validations ok before proceeding using Visual Studio 2008

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kilabyte
    New Member
    • Oct 2008
    • 5

    How do I check all validations ok before proceeding using Visual Studio 2008

    Hi,

    First post on here, I can't see that the question has been asked before.

    I am new to Visual Studio 2008 (using VB), but a seasoned programmer using Access and VBA.

    I have created a web site in VS and a form that the user fills in on a web page. The results are written to a record on a server once the send button is clicked on.

    10 items on the screen are validated (is a named entered, is an address entered, do money fields have a value etc) and a validation summary is created for any errors found.

    What I need to do is check if any items are shown in the summary before proceeding to write the file. If validation errors exist then the file is not posted.

    I have a Send button but that works whether a validation summary is displayed or not.

    Is their a way to read if a summary is displayed (validation errors exist) or not in VB 2008.

    I thought this may have shown it
    Code:
    Me.ValidationSummary1.Visible
    but it always shows as true.

    Any ideas (sure this must be simple when you know how and I am missing something obvious)?
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    If you want to display the validation summary then:

    Code:
    Me.ValidationSummary1.Visible = true ' or false to hide

    Comment

    • kilabyte
      New Member
      • Oct 2008
      • 5

      #3
      Thanks for the reply, but not a solution to my problem.

      Sorry probably not explained myself well.

      I know how to turn the summary on and off.

      What I need to do is detect whether the summary is actually displaying validation text (IE. validation errors are present on the page). If it is then I want to return out of the sub and not proceed until all the fields are correct filled in by the user.

      If no validation check text is showing (IE. user has filled in all the fields correctly) then to proceed to the next page.

      I could do it the old fashioned way in code to check each textbox has the expected output. But surely if the VS (VB) validator has already picked errors up I should be able to read that somehow as a group flag or similar.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by kilabyte
        Thanks for the reply, but not a solution to my problem.

        Sorry probably not explained myself well.

        I know how to turn the summary on and off.

        What I need to do is detect whether the summary is actually displaying validation text (IE. validation errors are present on the page). If it is then I want to return out of the sub and not proceed until all the fields are correct filled in by the user.

        If no validation check text is showing (IE. user has filled in all the fields correctly) then to proceed to the next page.

        I could do it the old fashioned way in code to check each textbox has the expected output. But surely if the VS (VB) validator has already picked errors up I should be able to read that somehow as a group flag or similar.
        Does this article help you at all?


        -Frinny

        Comment

        • kilabyte
          New Member
          • Oct 2008
          • 5

          #5
          Superb, thats exactly what I was looking for.

          I was sure an easy way must exist.

          Thanks for the help.

          Comment

          Working...