Format telephone numbers
-
- Posts: 52
- Joined: Sun Jun 05, 2016 9:35 pm
Format telephone numbers
I have a TextBox and need to format.
The telephone number is a string like this "27999999999" and I need to format like this "(27) 99999-9999"
How can I format this TextBox?
The telephone number is a string like this "27999999999" and I need to format like this "(27) 99999-9999"
How can I format this TextBox?
Re: Format telephone numbers
Hello.
Please, set the Custom Format with next mask:
or you could use next expression:
Thank you.
Please, set the Custom Format with next mask:
Code: Select all
(##) #####-####
Code: Select all
{27999999999.ToString("(##) #####-####")}
-
- Posts: 52
- Joined: Sun Jun 05, 2016 9:35 pm
Re: Format telephone numbers
I tried the first approach, did not work.
The field is string type and value is 99999999999 (eleven digits) two for long distance number and the rest telephone number.
The field is string type and value is 99999999999 (eleven digits) two for long distance number and the rest telephone number.
-
- Posts: 52
- Joined: Sun Jun 05, 2016 9:35 pm
Re: Format telephone numbers
Try changing textformat of telephone fields on the attached report (TELEFONES DE CONTATO)
- Attachments
-
- dadosXML.xml
- (5.89 KiB) Downloaded 227 times
-
- rptFichaMatricula2.mrt
- (155.48 KiB) Downloaded 228 times
Re: Format telephone numbers
Hello,
Please try to use the following expression:
Thank you.
Please try to use the following expression:
Code: Select all
{String.Format("{0:(##) #####-####}", System.Convert.ToInt64(DataSet1.TelefoneResidencialAluno))}
- Attachments
-
- Capture.PNG (155.61 KiB) Viewed 3844 times
-
- Posts: 52
- Joined: Sun Jun 05, 2016 9:35 pm
Re: Format telephone numbers
Is the only solution? I will have to check for null values, because not always I have a telephone number at this field.
Re: Format telephone numbers
Hello,
You can add the additional checks on the null values:
Thank you.
You can add the additional checks on the null values:
Code: Select all
{(DataSet1.TelefoneResidencialAluno == "" ? "" :String.Format("{0:(##) #####-####}", System.Convert.ToInt64(DataSet1.TelefoneResidencialAluno)))}
-
- Posts: 52
- Joined: Sun Jun 05, 2016 9:35 pm
Re: Format telephone numbers
Thanks! Problem solved!
Re: Format telephone numbers
Great!
We are glad to help you!
We are glad to help you!