> Hey guys,
i have a small question in C#. I have a windows form which has Address
fields, zip code and phone number fields. it is working fine with U.S. but
i
need to modify that for all the other countries. is there any way i can
validate zipcode and phone numbers.... Thanks in advance.
Create a class similar to NumberFormatInfo to contain regular expressions
for validating phone numbers, zip codes and similar. Create one instance for
every single culture your targeting and store the instance in an Hashtable
using the culture as the key. When validating an address retrieve the
correct "address info" object from the hashtable and use the regular
expressions to validate the different fields.
You will have to do some research to gather zip-code and telephone number
validation rules for all of the cultures though...
Anders Norås
http://dotnetjunkies.com/weblog/anoras/