• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Format Code for phone number in VS.NET

Experts,

I am working in a VS.NET file.  I wanted to ask the format code for a phone number in VS.NET?

Thanks.
0
jjrr007
Asked:
jjrr007
  • 3
  • 2
  • 2
  • +1
1 Solution
 
vadim63Commented:
Do you mean Mask?
0
 
vadim63Commented:
If mask, it could be
(999) 000-0000
0
 
jjrr007Author Commented:
In VS.NET properties window.

For Example, format code N0 is numbers without a decimal point.  I have raised the points level.  
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
vadim63Commented:
My guess - you can not do it without mask. Sorry.
0
 
Bob LearnedCommented:
Try this for U.S. phone numbers:

  Dim n As Integer = 1234567890
  Dim s As String = n.ToString("(000) 000-0000")

Bob
0
 
jjrr007Author Commented:
I am using the MS Reporting Reporting Services Module in VS.NET.  

The data type is Teradata.  So using VB.NET code won't work like this without a whole lot of work.  The options that I have (that I know of area):

Change the format box from the properties window.
Change the query in Teradata
Use Transact SQL code- directly in VS.NET Reporting Services 2003


Please advise.
0
 
Bob LearnedCommented:
Good thing that you clarified that.  Good luck finding an answer :D

Bob
0
 
Bill_PSCCommented:
You may try creating a seperate class to handle the format.

ie:

 Public Sub FormatPhone(ByVal sender As Object, ByVal e As ConvertEventArgs)
        Dim ph As String
        Try
            ph = e.Value
         e.Value = "(" + ph.Substring(0, 3) + ") " + ph.Substring(3, 3) + "-" + ph.Substring(6, 4)
        Catch
            e.Value = "Not Entered"
        End Try
    End Sub

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now