473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Validate Zip Code

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
ra**********@hotmail.com
May 3 '06 #1
2 1917
VJ
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

<rt*****@goddard-tech.com> wrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
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
ra**********@hotmail.com

May 3 '06 #2
Search for regular expression... you will find exactly what you need.

System.Text.RegularExpressions

This is a site with a lot of generic information related to it.

http://www.regular-expressions.info/
<rt*****@goddard-tech.com> a écrit dans le message de news:
Oi**************@TK2MSFTNGP03.phx.gbl...
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
ra**********@hotmail.com

May 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aevans1108 | last post by:
Greetings All If this is the wrong place to post this question, please give me a push in the right direction. Thanks. I know there has to be a simpler way to do this, but this is as simple a...
3
by: Claire | last post by:
I have a large record with many enumerated fields. The record is stored in a file and the fields have to be extracted. I validate the data as it's read, but there's so many tests similar to the...
6
by: Jonny | last post by:
Hi, I'm trying to validate my xml against a xsd but I can't get it to work. Originally, I wanted to validate an xml string but since I didn't get that to work I tried to validate an xml file...
26
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any...
4
by: Brybot | last post by:
I have a form that i've split up into multiple asp:panels, each panel has a number of validators which work correctly. At on the last panel, i want to commit the data collected to a database. I...
1
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. ...
24
by: Mike Hofer | last post by:
Please forgive the cross-post to multiple forums. I did it intentionally, but I *think* it was appropriate given the nature of my question. I'm working on an open source code library to help...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.