Jump to content

[Resolvido] KeyPress Validações


hypz

Recommended Posts

Que deixe, aqui está o código que estou a usar.

If Not IsNumeric(e.KeyChar) Then
           ToolTip1.Show("Campo Obrigatório, só números.", sender, 5000)
           e.KeyChar = Nothing
       End If

Eu estava a testar com isto até mas nada dá resultado..

Dim allowedChars As String = "-"
       If Not IsNumeric(e.KeyChar) Then
           ToolTip1.Show("Campo Obrigatório, só números.", sender, 5000)
           e.KeyChar = Nothing
       ElseIf allowedChars.IndexOf(e.KeyChar) = 0 Then
           e.Handled = True
       End If
Link to comment
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.