taandar Posted May 24, 2006 at 10:01 AM Report #29258 Posted May 24, 2006 at 10:01 AM olá pessoal Sou novo. por aqui 👍 ... Espero q me possam ajudar, eu ponho á disposicao os meus conhecimentos. cá vai eu pretendo limitar a introducao de caracteres numa textBox e para tal utlizei algo parecido com isto private Sub txtdia_KeyPress(KeyAscii As Integer) If KeyAscii < 49 Or KeyAscii > 57 Then If KeyAscii <>8 Then KeyAscii=0 End If End Sub e tudo fixe, resulta o Problema é q quando introduzo este codigo numa textBox q faz parte de um array de textBox o VB dá erro e diz algo do tipo q o código é repetido. já tentei de varias formas de iniciar a funcao mas nada. se alguem souber... agradeço desde já
freesumo Posted May 24, 2006 at 12:34 PM Report #29290 Posted May 24, 2006 at 12:34 PM Para uma textbox array a sub correcta é, Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer). Por exemplo, imagina que tu tens uma array de 4 textboxes e que tu só queres que a textbox nº1 aceite números e a tecla back: Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) If Index = 1 Then If KeyAscii < 49 Or KeyAscii > 57 Then If KeyAscii <> 8 Then KeyAscii = 0 End If End If End Sub cyas 👍
taandar Posted May 25, 2006 at 09:34 AM Author Report #29429 Posted May 25, 2006 at 09:34 AM mt obrigado freesumo Era isso mesmo q eu estava á procura nao tenho aqui o VB mas logo ja vou experimentar isso abraços
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now