Maskara de entrada (mask)
Publicado por hixem (178 intervenciones) el 28/01/2005 10:14:55
Para validar que solo admita un tipo de ntrada bien sea numerica o alfanumerica en el evento keypress del textbox introducir lo siguiente:
Private Sub txtaño_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtaño.KeyPress
If e.KeyChar.IsLetter(e.KeyChar) Then
' MessageBox.Show("es letra")
e.Handled = True ' no me permite escribir
Else
'MessageBox.Show("es numero")
End If
End Sub
Private Sub txtaño_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtaño.KeyPress
If e.KeyChar.IsLetter(e.KeyChar) Then
' MessageBox.Show("es letra")
e.Handled = True ' no me permite escribir
Else
'MessageBox.Show("es numero")
End If
End Sub
Valora esta pregunta
0