How to use Shortcut Key in C Sharp (C#) Programm.
I am created 2 forms using c# (Form A and Form B). From Form A i want to open Form B when I press a Key from Keyboard (F2).
Steps
1. Set Form A KeyPreview Property to True.
2. Write needed code in Form A KeyDown Event.
Done...Check it out.
I am created 2 forms using c# (Form A and Form B). From Form A i want to open Form B when I press a Key from Keyboard (F2).
Steps
1. Set Form A KeyPreview Property to True.
2. Write needed code in Form A KeyDown Event.
private void A_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F2)
{
new B().Show();
}
}
{
if (e.KeyCode == Keys.F2)
{
new B().Show();
}
}
Done...Check it out.
No comments:
Post a Comment