Click here to Skip to main content
15,851,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My problem is that I use key down event but in key down "e.KeyCode == Keys.E && e.Control" is working proper but "e.KeyCode == Keys.N && e.Control" is not working Why its working only with Cntrl+shift+N plz help me

What I have tried:

"e.KeyCode == Keys.N && e.Control"
Posted
Updated 11-Apr-17 23:01pm

1 solution

It works fine for me:
C#
private void frmTest_KeyDown(object sender, KeyEventArgs e)
    {
    if (e.KeyCode == Keys.N && e.Control)
        {
        Console.WriteLine("CTRL+N");
        }
    }
At a guess, you don't have KeyPreview set to true, or you have a shortcut key assigned to CTRL+E or CTRL+N which is getting precedence.

If that doesn't help, we will need a load more info on exactly how you are using that code.
 
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