2
Good evening, I’m having trouble creating a mask that accepts both cell phone number and phone number in the same textbox, I tried to use the maskedinput no more rolled.. Any idea how you could do it? And what event would be best to put it in? (keypress, keyup, keydown, Leave)
Thank you in advance for your help!
There’s an excerpt of the code I’ve made so far using the maskedinput..
String telefone = Useful_methods.TextNoFormatting(txtTelefone_1);
if (telefone.Length >= 10)
{
txtTelefone_1.Mask = "(00)00000-0000";
txtTelefone_1.Select(txtTelefone_1.Text.Length, 1);
}
else
{
txtTelefone_1.Mask = "(00)0000-00009";
}
You want the format to be validated while the user enters the number or it can be in the event of
LostFocus
?– João Martins
can be in Lostfocus
– Joao Pedro