HOW CAN MAKE SHORTCUT KEYS IN MY WINDOWS FORM?

jayprakash sharma

Total Post:117

Points:821
Posted by  jayprakash sharma
C# 
C#
 1233  View(s)
Ratings:
Rate this:
I need to make a shortcut key for open a new form in my application how I can do that task.
  1. Manoj Bhatt

    Post:154

    Points:1086
    Re: How can make shortcut keys in my windows form?

    1.       Create a demo project with 2 windows form

    2.       Then you can add the below code in your form1_keyDown event

    if (e.Control && e.KeyCode == Keys.N)

    {

         Form2 f2 = new Form2();

         f2.Show();

    }

    e.Control : This mean hold the control key

    e.KeyCode == Keys.N: This mean press the N key form your keyboard

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!