Visual Basic - restriccion

Life is soft - evento anual de software empresarial
 
Vista:

restriccion

Publicado por Jose Treto Mall (20 intervenciones) el 05/03/2005 19:38:52
Quisiera que me digan como hago para que una textbox no acepte numeros y tambien otro que no acepte letras
Se los agradeceria mucho
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:restriccion

Publicado por Benjo (679 intervenciones) el 06/03/2005 04:46:04

Public Function SoloCaracteres(ByVal strFiltro As String, ByVal KeyAscii As Integer, ByVal Largo As Integer, ByVal LargoPermitido As Integer, ByVal SelStr As Integer) As Integer
If InStr(strFiltro, Chr(KeyAscii)) = 0 Then
SoloNumeros = 0
Else
SoloNumeros = KeyAscii
End If
If SoloNumeros <> 0 Then
If (Largo + 1) > LargoPermitido And SelStr = 0 Then
SoloNumeros = 0
End If
End If
If KeyAscii = 8 Then SoloNumeros = KeyAscii ' borrado atras
If KeyAscii = 13 Then SoloNumeros = KeyAscii ' return
End Function

Private Sub txtCedula_KeyPress(KeyAscii As Integer)
'Este ejemplo únicamente te permite escribir números del 0 al 9
' y letras V,E,J, e y minúscula.

KeyAscii = SoloCaracteres("VEJy-0123456789", KeyAscii, Len(txtCedula.Text), 10, txtCedula.SelLength)
If KeyAscii = 13 Then Call cmdingresar_Click
End Sub

Puede que te sirva.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar