Help..
I am using the String.format() method and getting the following error...
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Input string was not in a correct format.
Here is the line of the code causing it...
strResult = String.Format("{^d-d{3}-d{3}-d{4}}", hpformato)
The "hpformato" is Dimmed as String. I don't know why this is not working..Help
Chicago75@evildata.com
Comments
: I am using the String.format() method and getting the following error...
:
: An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
: Additional information: Input string was not in a correct format.
:
: Here is the line of the code causing it...
:
: strResult = String.Format("{^d-d{3}-d{3}-d{4}}", hpformato)
:
: The "hpformato" is Dimmed as String. I don't know why this is not working..Help
: Chicago75@evildata.com
:
:
:
:
:
I believe the String.Format does not support regular expressions, at least natively. I suppose if you create your own format provider class it could work.
Try this versionfor formatting a phone number ...
strResult = String.Format("{0}-{1}-{2}", _
Left(hpformato, 3), _
Mid(hpformato, 4, 3), _
Right(hpformato, 4))