Jump to content
petelson pascoal

[Resolvido] Validar telefone na textbox

Recommended Posts

petelson pascoal

amigos preciso de ajuda para validar telefones do Tipo: 927-175 -449 ______ 913-632-451 e 222-231-619

me ajudem por favor

Share this post


Link to post
Share on other sites
petelson pascoal

Porque não utilizas uma MaskedTextBox, ou não serve para o que pretendes?

podes dar um exemplo

Share this post


Link to post
Share on other sites
petelson pascoal

Dim Verifica As Match = System.Text.RegularExpressions.Regex.Match(Txt_fone1.Text, "^[91-94]{2}[0-9]{7}$")

podes me ajudar a corrigir está variavel de acordo ao meu problema?

Edited by petelson pascoal

Share this post


Link to post
Share on other sites
petelson pascoal

Talvez assim

"^[0-9]{3}[0-9]{7}$"

Valeu pela mano.

fiz este código e deu certo

Dim fone As String = "927-231-323"
fone = TextBox1.Text
If ((fone Like "[!29][56789]#-###-###") Or (fone Like "[92][!1234]#-###-###") Or (fone Like "[!29][1234]#-###-###")) Then
MsgBox("Numero Invalido")
Else
MsgBox("Bom")
End If

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.