Maskedtextbox Interactive for Mobile Phone Number

Asked

Viewed 128 times

0

I have a Maskedtextbox on my system with the following format (xx) 9xxxx-xxxx for mobile phones that have the digit 9 more, but in some states do not have this digit more getting like this (xx) xxxx-xxxx.

How do I make for the Mascara be interactive to add one digit more or less?

  • That I know the ninth digit has already been implemented throughout Brazil

1 answer

0

You will have to use String.Format. In your case, you just need to take the contents of your Textbox and change the format.

it’s going to look something like this:

long cel = Convert.ToInt64(txt.Text);
string celFormatado= String.Format(@"{(00)\0000-0000}", cel );
txt.Text = celFormatado;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.