intercepting key from keyboard and rejecting it completely

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
 
R

RoyVidar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top