Salve, mi servirebbe di utilizzare una funzione che in alcune text l'utente può inserire solo caratteri o solo numeri o caratteri/Numeri.... (in questo es x l'autenticazione utente con nome utente e password)
ho provato a fare così:
Private Sub txtNomeUtente_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNomeUtente.KeyPress, txtPassword.KeyPress
If (((e.KeyChar >= "0") And (e.KeyChar <= "9")) Or ((e.KeyChar >= "A") And (e.KeyChar <= "Z")) Or ((e.KeyChar >= "a") And (e.KeyChar <= "z"))) Then
... codice ...
End If
End Sub
così funzionerebbe ma non so come annullare il tasto e non farlo scrivere nella text ... e poi , per prova al posto di "...codice..." ho messo "beep()" e così se premo il tasto backspace suonava sempre, allora come si può fare??
Grazi mille