Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format phone # list view

Status
Not open for further replies.

brews

Technical User
Dec 12, 2007
194
US
Have a listview with eight columns. One contains phone numbers which is a challenge for me to present in the usual manner, ie (000) 000-0000.

The data is stored in an Access db, stored as text, formatted in the db as !\(999") "000\-0000;;_, 14 characters. Have tried formatnumber(file, 10), format(file, "(000) 000-0000" which presents all zeros.

Some of the code:
Code:
         With lvwDisplay
            .Show()
            .Items.Clear()
            .Columns.Add("ID", 0)
            .Columns.Add("Acct#", 50)
            .Columns.Add("Name", 200)
            .Columns.Add("Address", 210)
            .Columns.Add("City, State Zip", 140)
            .Columns.Add("Telephone", 100)
            .Columns.Add("Amt Paid", 80, HorizontalAlignment.Right)
            .Columns.Add("Date Pd", 100)
            .Refresh()
        End With
        Dim sItem As ListViewItem
        For Each nc In lv
            sKey = Format(nc.CustomerID, "0000")
            sName = Trim(nc.Lastname) & ", " & Trim(nc.Firstname)
            sItem.Text = CStr(sKey)            
            sItem.SubItems.Add(nc.Phone)
            sItem.SubItems.Add(sName)
        Next nc ' where nc is a class
Any ideas would be helpful. thank you.
 
Hi,

Only numeric data can be DISPLAY FORMATTED.

If you have TEXT, it must be CHANGED which is significantly different than NUMBER FORMATTING.


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top