473,473 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Phone Format (770) 123-1234

Hi,

How do I apply phone format in a string field? for example (770) 123-1234.
Please let me know.

Thanks.

Eddy
Nov 17 '05 #1
3 12500
Hi Eddy,

If you are validating input, you can use a RegularExpressionValidator and
select U.S. Phone Number in the Regular Expression Editor (by clicking the
elipses in the ValidationExpression box in the RegularExpressionValidator's
Properties window).
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Eddy Soeparmin" <es********@clientprofiles.com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I apply phone format in a string field? for example (770) 123-1234.
Please let me know.

Thanks.

Eddy

Nov 17 '05 #2
you'd have to use javascript to do this
"Eddy Soeparmin" <es********@clientprofiles.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Ray,

No, this is not at validation. It's for display. For example, I just
retrieved data from database and would like to display phone number in (123) 123-1234 format within a datagrid.

Eddy

"Ray Dixon [MVP]" <ra*@NOSPAM.greeble.com> wrote in message
news:uu**************@TK2MSFTNGP12.phx.gbl...
Hi Eddy,

If you are validating input, you can use a RegularExpressionValidator and
select U.S. Phone Number in the Regular Expression Editor (by clicking the elipses in the ValidationExpression box in the

RegularExpressionValidator's
Properties window).
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Eddy Soeparmin" <es********@clientprofiles.com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I apply phone format in a string field? for example (770)

123-1234. Please let me know.

Thanks.

Eddy



Nov 17 '05 #3
Function FormatPhoneNumbers(ByVal strInputPhoneNumber As String) As String

'Strip off the ( , ) and -

Dim strPhoneNumber As String

strInputPhoneNumber = strInputPhoneNumber.Replace(" ", "")

strInputPhoneNumber = strInputPhoneNumber.Replace("(", "")

strInputPhoneNumber = strInputPhoneNumber.Replace(")", "")

strInputPhoneNumber = strInputPhoneNumber.Replace("-", "")

'Now format it

If strInputPhoneNumber.Length >= 3 Then

strPhoneNumber = "(" & strInputPhoneNumber.Substring(0, 3) & ") "

If strInputPhoneNumber.Length < 6 Then

strPhoneNumber = strPhoneNumber & strInputPhoneNumber.Substring(3,
strInputPhoneNumber.Length - 3)

Else

strPhoneNumber = strPhoneNumber & strInputPhoneNumber.Substring(3,
3) & "-" & strInputPhoneNumber.Substring(6)

End If

End If

Return strPhoneNumber

End Function
--
Swanand Mokashi
Microsoft Certified Professional
http://www.swanandmokashi.com/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"Eddy Soeparmin" <es********@clientprofiles.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Ray,

No, this is not at validation. It's for display. For example, I just
retrieved data from database and would like to display phone number in (123) 123-1234 format within a datagrid.

Eddy

"Ray Dixon [MVP]" <ra*@NOSPAM.greeble.com> wrote in message
news:uu**************@TK2MSFTNGP12.phx.gbl...
Hi Eddy,

If you are validating input, you can use a RegularExpressionValidator and
select U.S. Phone Number in the Regular Expression Editor (by clicking the elipses in the ValidationExpression box in the

RegularExpressionValidator's
Properties window).
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Eddy Soeparmin" <es********@clientprofiles.com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I apply phone format in a string field? for example (770)

123-1234. Please let me know.

Thanks.

Eddy



Nov 17 '05 #4

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

Similar topics

5
by: joemono | last post by:
Hello everyone! First, I appologize if this posting isn't proper "netiquette" for this group. I've been working with perl for almost 2 years now. However, my regular expression knowledge is...
2
by: Roxie Aho | last post by:
Using Access 2003. Linked table from SQL Server has phone as 1234567890. Query has phone formatted as (@@@) @@@-@@@@, displaying (123) 456-7890. Data access page is based on the query. Phone...
2
by: Dman | last post by:
Having trouble in Access XP. I want to display the customers name, city and phone number in a Combo Box but the but the formatting is lost – eg (123) 456-7890 is displayed as 1234567890. Any...
2
by: MLH | last post by:
Using A97, I have tables with 10-char text phone number fields to allow entry of xxxyyyyyyy phone numbers - where xxx is the 3-digit area code and yyyyyyy is the 7-digit phone number. I wish to...
2
by: RD | last post by:
We always have to have an area code but user does not always have to dial the long distance digit 1 before the area code. When user does not have to make long distance call the phone number our...
4
by: Brian Henry | last post by:
I have phone numbers like this in a data table 123-435-1234 1231231234 432.234.2321 they all have different formatting, what I want to do is get them all formatted like this (123) 123-1234
1
by: MuZZy | last post by:
Hi, One of our bigger clients requested to have a phone automation option for our CRM product (developed on C#) as they are using it now with ACT CRM. Unfortunately i don't have much info on how...
7
by: laredotornado | last post by:
Hi, Using php 4.4.4, I am looking to parse a US phone number string into 3 smaller strings -- area code, the first part of the phone number (3 digits) and the last part of the phone number (4...
2
by: David C | last post by:
Is there a way to validate a specific phone# format on a control? I also want to be able to have the user enter an extension as part of the text. For example, the following would be valid. ...
8
by: Nour469 | last post by:
Hi, I encountered a problem and wondering if anyone can help. I have clients and their phone nos stored, I used The data Type: Text and InputMask as "phone: (123) 123-4567 " but when I conduct a...
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.