Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# scripts to validate zip codes & strings

C# scripts to validate zip codes & strings

Scheduled Pinned Locked Moved C#
csharpcomhelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Reed Eichner
    wrote on last edited by
    #1

    I need access to C# scripts for validating zip codes in three formats: ##### or #####-#### or ##### #### (no dash) & strings entered in forms @ ASP pages (running on .NET platform). Any help would be most appreciated! Many thanks!:eek: Reed Eichner reichner@satx.rr.com

    J 1 Reply Last reply
    0
    • R Reed Eichner

      I need access to C# scripts for validating zip codes in three formats: ##### or #####-#### or ##### #### (no dash) & strings entered in forms @ ASP pages (running on .NET platform). Any help would be most appreciated! Many thanks!:eek: Reed Eichner reichner@satx.rr.com

      J Offline
      J Offline
      John Kuhn
      wrote on last edited by
      #2

      Take a look at the validators -- RequiredFieldValidator, RangeValidator, and RegularExpressionValidator -- as they encapsulate all of the functionality that should allow you to determine if something is in the right format to be a zipcode. There are samples here on CP and in MSDN. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

      R 1 Reply Last reply
      0
      • J John Kuhn

        Take a look at the validators -- RequiredFieldValidator, RangeValidator, and RegularExpressionValidator -- as they encapsulate all of the functionality that should allow you to determine if something is in the right format to be a zipcode. There are samples here on CP and in MSDN. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

        R Offline
        R Offline
        Reed Eichner
        wrote on last edited by
        #3

        John: thanks for your feedback! However, I'm not a proficient coder...do you have the links to the respective script (pre-written code) that I can download & incorporate into an ASPX page? Reed:zzz: Reed Eichner reichner@satx.rr.com

        H J 2 Replies Last reply
        0
        • R Reed Eichner

          John: thanks for your feedback! However, I'm not a proficient coder...do you have the links to the respective script (pre-written code) that I can download & incorporate into an ASPX page? Reed:zzz: Reed Eichner reichner@satx.rr.com

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Great - don't even try, and rip other people's code off for something so simple. You won't learn anything that way. Try reading the class documentation for these validators in the .NET Framework SDK. They even include samples. And things like the RequiredFieldValidator are so simple - all you have to do is set the control name to validate (ControlToValidate property) and an error message (ErrorMessage property) at the bare minimum.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          • R Reed Eichner

            John: thanks for your feedback! However, I'm not a proficient coder...do you have the links to the respective script (pre-written code) that I can download & incorporate into an ASPX page? Reed:zzz: Reed Eichner reichner@satx.rr.com

            J Offline
            J Offline
            John Kuhn
            wrote on last edited by
            #5

            Reed, Sorry, not off the top of my head. I'd have to do just what Heath suggests or look them up, too. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups