MaskedTextBox Interactive for Cell Number

0

I have a MaskedTextBox on my system with the following format (xx) 9xxxx-xxxx for mobile phones that have the digit 9 plus, but in some states they do not have this extra digit thus getting (xx) xxxx-xxxx .

How do I make Mascara interactive to add a plus or minus digit?

    
asked by anonymous 04.12.2017 / 03:07

1 answer

0

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

It will look something like this:

long cel = Convert.ToInt64(txt.Text);
string celFormatado= String.Format(@"{(00)
long cel = Convert.ToInt64(txt.Text);
string celFormatado= String.Format(@"{(00)%pre%00-0000}", cel );
txt.Text = celFormatado;
00-0000}", cel ); txt.Text = celFormatado;
    
05.12.2017 / 11:44