M
Matt
I'm trying to write a shared function that will convert all my phone numbers
from format 1234567890 to (123) 456-7890.
Here is my function that I wrote:
Public Shared Function CheckPhone(byVal val as String) as String
dim strCheckPhone as String
If val = "" Then
strCheckPhone = ""
Elseif val = nothing then
strCheckPhone = ""
else
strCheckPhone = Format(Convert.ToDouble(val), "(###) ###-####")
End If
return strCheckPhone
End Function
Here is my compile command:
c:\windows\microsoft.net\framework\v1.1.4322\vbc.exe /t:library
/r:System.Data.dll /r:System.dll functions.vb
Here is what I am importing:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.Text.UTF8Encoding
Imports System.configuration
Imports System.Security.Cryptography
Imports System.Web
Imports System.Text.Encoding
(There are some other functions in this file, so I know that most of those
don't relate to this function.)
And here are the errors I receive:
C:\Documents and Settings\m\Desktop\functions.vb(180) : error BC30451:
******************************************************************
Name 'Format' is not declared.
strCheckPhone = Format(Convert.ToDouble(val), "(###) ###-####")
~~~~~~
******************************************************************
C:\Documents and Settings\m\Desktop\functions.vb(180) : error BC30561:
******************************************************************
'Convert' is ambiguous, imported from the namespaces or types
'System.Text.Encod
ing, System'.
strCheckPhone = Format(Convert.ToDouble(val), "(###) ###-####")
~~~~~~~
******************************************************************
Thanks for your help.
Matt
from format 1234567890 to (123) 456-7890.
Here is my function that I wrote:
Public Shared Function CheckPhone(byVal val as String) as String
dim strCheckPhone as String
If val = "" Then
strCheckPhone = ""
Elseif val = nothing then
strCheckPhone = ""
else
strCheckPhone = Format(Convert.ToDouble(val), "(###) ###-####")
End If
return strCheckPhone
End Function
Here is my compile command:
c:\windows\microsoft.net\framework\v1.1.4322\vbc.exe /t:library
/r:System.Data.dll /r:System.dll functions.vb
Here is what I am importing:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.Text.UTF8Encoding
Imports System.configuration
Imports System.Security.Cryptography
Imports System.Web
Imports System.Text.Encoding
(There are some other functions in this file, so I know that most of those
don't relate to this function.)
And here are the errors I receive:
C:\Documents and Settings\m\Desktop\functions.vb(180) : error BC30451:
******************************************************************
Name 'Format' is not declared.
strCheckPhone = Format(Convert.ToDouble(val), "(###) ###-####")
~~~~~~
******************************************************************
C:\Documents and Settings\m\Desktop\functions.vb(180) : error BC30561:
******************************************************************
'Convert' is ambiguous, imported from the namespaces or types
'System.Text.Encod
ing, System'.
strCheckPhone = Format(Convert.ToDouble(val), "(###) ###-####")
~~~~~~~
******************************************************************
Thanks for your help.
Matt