
29/05/2008, 14:47
|
 | Moderador | | Fecha de Ingreso: febrero-2002 Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 23 años Puntos: 50 | |
Respuesta: Validar TextBox Cita:
Iniciado por Malenko Una opción más elegante sería usar un RegularExpressionValidator :)
Código:
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "\d") Then
MessageBox.Show("NO INGRESE NUMEROS","ALERTA")
e.Handled = True
End If
End Sub
|