Newbie Keypress Question

  • Thread starter Thread starter TerryW
  • Start date Start date
T

TerryW

Does anyone know how to remove keypress events at form level before
they are passed onto individual controls?

For example I have a text box in my form. I set keypreview to true.
In VB 6 when I received the form_Keypress I would set the keyascii =
0. This way the text box didn't get the keypress. Is there a way to
do the same thing in vbDotNet?

TIA
Terry
 
You can still do the same thing in VB.NET as well.

1. Set the form's KeyPreview property to True.
2. In the form's KeyPress event, set e.Handled = True for characters you
want to suppress. (e is an instance of KeyPressEventArgs type).

"TerryW @vbssys.com>" <prog<NOSPAM> wrote in message
Does anyone know how to remove keypress events at form level before
they are passed onto individual controls?

For example I have a text box in my form. I set keypreview to true.
In VB 6 when I received the form_Keypress I would set the keyascii =
0. This way the text box didn't get the keypress. Is there a way to
do the same thing in vbDotNet?

TIA
Terry
 

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

Back
Top