VISUAL BASIC 2008
'CÓDIGO PARA QUE SOLO ACPTE DATOS DE TIPO NUMERO, EN LA CLAVE DE ALUMNO
Private Sub tExtboX1_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
If Char.IsNumber(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsSeparator(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Dim numeros() As Char = {“1″, “2″, “3″, “4″, “5″, “6″, “7″, “8″, “9″, “0″}
Private Sub txtCuadro_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles txtCuadro.KeyPress
If Array.IndexOf(numeros, e.KeyChar) >= 0 Then
e.Handled = False
Else
e.Handled = True
End If
Suscribirse a:
Enviar comentarios (Atom)
0 comentarios: