Form KeyPress e.Handled question

K

Keith Smith

If a KeyUp event takes place on my form, how can I keep the
KeyDown/KeyPress/KeyUp events from being run on the control event itself.

I tried putting e.Handled=true; at the end of my KeyUp event, but that
doesn't seem to work. Am I missing something? It appears that the KeyUp
event on my control still runs. Help!
 
M

Mickey Williams [C# MVP]

Keith Smith said:
If a KeyUp event takes place on my form, how can I keep the
KeyDown/KeyPress/KeyUp events from being run on the control event itself.

Override the ProcessKeyPreview method. The message ID is included in the
event args -- look for the messages you want to filter, and return true if
you handle them in the form.
 

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