Hey,
String.Format("{0:(###) ###-####}", 1231231234) produces (123) 123-1234
String.Format("{0:(###) ###-####}", 123) produces
() -123
How can I left align it so that if only 3 digits are provided, it returns (123) -
Thanks,
Printable View
Hey,
String.Format("{0:(###) ###-####}", 1231231234) produces (123) 123-1234
String.Format("{0:(###) ###-####}", 123) produces
() -123
How can I left align it so that if only 3 digits are provided, it returns (123) -
Thanks,
Sorry I am not able to get you..
Hello,
Is this input coming from a textbox, and you are having to put it into the correct format?
If so, have you thought about using a masked textbox?
http://msdn.microsoft.com/en-us/libr...edtextbox.aspx
I think that might makes things a bit easier.
Hope that helps!!
Gary
i think hes saying how can he fill in the area code first if there are only 3 numbers
im not sure but one way to cheat might be something like
if textbox.text.length== 3
{
format string one way
}
else
{
String.Format("{0###) ###-####}", 1231231234)
}