Click here to Skip to main content
15,741,892 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have used key down event to fix shortcut for some events.

Actually I have Fixed code for F4. But when I press Ctrl+F4,Shift +F4 that time
also that F4 code gets executed.

How to restrict this?

Thanks &Regards ,
OriginalGriff 19-May-12 2:38am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Possibly, showing the code fragment which handles the KeyDown event would help...
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Hi palraj001,

I think this may help you:

private void textBox1_KeyDown(object sender, KeyEventArgs e)

            if (e.KeyCode == Keys.F4 || (e.KeyCode == Keys.F4 && Control.ModifierKeys == Keys.Control) || (e.KeyCode == Keys.F4 && Control.ModifierKeys == Keys.Alt) || (e.KeyCode == Keys.F4 && Control.ModifierKeys == Keys.Control && Control.ModifierKeys == Keys.Alt))


The example above restricts F4 key in every combination with modifiers.

Happy Coding :)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900