by Jayan Mavelikara (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 30th July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
format phone number
'in the button click event put this code.
Text1.Text = "8002622823" ' format it like (800)262-2823
Dim temp1 As String
temp1 = "("
temp1 = temp1 & Left(Text1.Text, 3)
temp1 = temp1 & ")"
temp1 = temp1 & Mid(Text1.Text, 4, 3)
temp1 = temp1 & "-"
temp1 = temp1 & Right(Text1.Text, 4)
Text2.Text = temp1 'display the result