Advertise with us

How can make shortcut keys in my windows form?

I need to make a shortcut key for open a new form in my application how I can do that task.
Last updated:10/8/2013 1:09:03 AM

1 Answers

Manoj Bhatt
Manoj Bhatt

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