maiconsnp
31-05-2016 16:24:24
Boa Tarde Pessoal, tenho o seguinte códigos que fazem a formatação dos textbox celular e Telefone ambos isso dividida em duas textbox.
esse formata a textebox Telefone
'Limita a Qde de caracteres
txt_telefone.MaxLength = 14
'Aplicar formato (xx)xxxx-xxxx
If Len(txt_telefone) = 0 Then txt_telefone.Text = txt_telefone.Text & "("
If Len(txt_telefone) = 3 Then txt_telefone.Text = txt_telefone.Text & ") "
If Len(txt_telefone) = 9 Then txt_telefone.Text = txt_telefone.Text & "-"
--------------------------------------------------------------------------------------------------------------
esse formata a textbox Celular
'Limita a Qde de caracteres
txt_celular.MaxLength = 15
'Aplicar formato (xx)xxxx-xxxx
If Len(txt_celular) = 0 Then txt_celular.Text = txt_celular.Text & "("
If Len(txt_celular) = 3 Then txt_celular.Text = txt_celular.Text & ") "
If Len(txt_celular) = 10 Then txt_celular.Text = txt_celular.Text & "-"
pretendo colocar esses dois em somente uma textbox ou seja que quando eu digitar, um numero que não contenha o 9º digito ele faça a sua formatação normal, a mesma regra vale para números com o 9º digito alguém poderia me auxiliar neste caso.
desde ja muito obrigado.
esse formata a textebox Telefone
'Limita a Qde de caracteres
txt_telefone.MaxLength = 14
'Aplicar formato (xx)xxxx-xxxx
If Len(txt_telefone) = 0 Then txt_telefone.Text = txt_telefone.Text & "("
If Len(txt_telefone) = 3 Then txt_telefone.Text = txt_telefone.Text & ") "
If Len(txt_telefone) = 9 Then txt_telefone.Text = txt_telefone.Text & "-"
--------------------------------------------------------------------------------------------------------------
esse formata a textbox Celular
'Limita a Qde de caracteres
txt_celular.MaxLength = 15
'Aplicar formato (xx)xxxx-xxxx
If Len(txt_celular) = 0 Then txt_celular.Text = txt_celular.Text & "("
If Len(txt_celular) = 3 Then txt_celular.Text = txt_celular.Text & ") "
If Len(txt_celular) = 10 Then txt_celular.Text = txt_celular.Text & "-"
pretendo colocar esses dois em somente uma textbox ou seja que quando eu digitar, um numero que não contenha o 9º digito ele faça a sua formatação normal, a mesma regra vale para números com o 9º digito alguém poderia me auxiliar neste caso.
desde ja muito obrigado.