Visual Basic - Entrada de Caracteres

Life is soft - evento anual de software empresarial
 
Vista:

Entrada de Caracteres

Publicado por Ibrahim (3 intervenciones) el 19/08/2005 23:15:49
Hola al q me pueda ayudar, necesito saber como resgistrar determinados caracteres en una caja de texto, validarlo y luego pasar a la siguiente caja automaticamente, gracias por tu ayuda.
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:Entrada de Caracteres

Publicado por Angel (19 intervenciones) el 20/08/2005 01:12:08
'En este evento uso dos funciones para validar entradas en longitud y
'tipo de datos y luego paso el foco al siguiente control al pulsar enter
Private Sub text5_KeyPress(KeyAscii As Integer)
KeyAscii = LargoTxt(KeyAscii, Text5.Text, 15)
KeyAscii = SoloNumeros(KeyAscii)
If KeyAscii = 13 Then Text6.SetFocus
End Sub

'Aqui seguidamente te muestro las funciones
Function LargoTxt(ByVal KeyAscii As Integer, texto As String, largo As Integer) As Integer
If Len(texto) = largo And KeyAscii <> 13 And KeyAscii <> 8 Then
LargoTxt = 0
Else
LargoTxt = KeyAscii
End If
End Function

'En esta funcion ves como validar entradas de numeros y otros caracteres
Function SoloNumeros(ByVal KeyAscii As Integer) As Integer
If InStr("0123456789.,+-*/", Chr(KeyAscii)) = 0 Then
SoloNumeros = 0
Else
SoloNumeros = KeyAscii
End If
If KeyAscii = 8 Then SoloNumeros = KeyAscii 'Backspace
If KeyAscii = 13 Then SoloNumeros = KeyAscii 'Enter
End Function
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