ACEITAR LETRAS E NUMEROS VB6

DRHOUSE 29/08/2009 06:05:57
#321317
Olá pessoal teria como este codigo para VB6 ser mais simples e direto? Penso que há algo de errado nele se alquem poder me ajudar, ele só aceitara letras e numeros para ser digitado no campo.

Private Sub txtResposta_KeyPress(KeyAscii As Integer)
If InStr(1, [Ô]0123456789abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ[Ô] & vbKeyDelete, Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub

Obrigado.
ARNALDOCRUZ 29/08/2009 08:53:11
#321321
Resposta escolhida
If (KeyAscii < 48 Or KeyAscii > 57) Then ( SÓ NUMEROS)
If (KeyAscii < 65 Or KeyAscii > 90) Then (SÓ LETRAS MAIUSCULAS)
If (KeyAscii < 97 Or KeyAscii > 122) Then (SÓ LETRAS MINUSCULAS)
If (KeyAscii <> 8) Then (APAGA CARACTER POR CARACTER)
KeyAscii = 0
End If
END IF
END IF
End If
DRHOUSE 29/08/2009 09:39:30
#321324
ARNALDOCRUZ muito obrigado deu certinho!
No caso para aceitar espaço e o caracter [Ô]?[Ô] como ficaria?
WHELLNET 29/08/2009 11:24:27
#321336
Cara, não é mais fácil definir os caracteres que não serão aceitos?
Private Sub txtResposta(KeyAscii As Integer)
Select Case UCase(Chr(KeyAscii))
Case [Ô]?[Ô], [Ô]![Ô], [Ô]$[Ô] [ô]Caracteres que não serão aceitos
KeyAscii = 0
End Select
End Sub
Tópico encerrado , respostas não são mais permitidas