Validate Zip Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm new using c#.net

I need to validate the zipcode.

How I can be sure that only zipcode are typed and when the users type 5
digits zipcode the "-" do not get save in the record.

Rafael Tejera
(e-mail address removed)
 
Check for Regular Expressions... in System.Text.RegularExpression to match a
zip code of 55555-5555, then when that match is done.. all you have to do is
remove the "-" , which will be...

string sZipCode = "55555-5555";
// use regular expression to validate
sZipCode.Replace("-","");

Vijay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top