intercepting key from keyboard and rejecting it completely

  • Thread starter Thread starter alekm
  • Start date Start date
A

alekm

Hi,
I've got a text box. How do I intercept specific key from a keyboard and
make it as just it never happened, ie. reject it completely before even
cursor in text box moves?
thanx

alek_mil
 
alekm said:
Hi,
I've got a text box. How do I intercept specific key from a keyboard
and make it as just it never happened, ie. reject it completely
before even cursor in text box moves?
thanx

alek_mil

You can use the KeyPress event of the text control, check for the
ASCII value, and cancel it.

Say

Private Sub TheControl_KeyPress(KeyAscii As Integer)

' disallows chr(34) -> quote (")
If KeyAscii = 34 Then
KeyAscii = 0
End If

End Sub
 
Back
Top