2
Answers

Function Key Press(F1,F2 ....F2) OPen Window Form

Photo of g s

g s

9y
5.5k
1

 Window application C#  Function Key Press(F1,F2 ....F2) OPen Window Form 

Answers (2)

0
Photo of Dipankar Biswas
NA 3k 125.6k 9y
hi..

  private void Form1_KeyPress(object sender, KeyPressEventArgs e)
  {

  if (e.KeyChar == (char)Keys.f)
  {
  Form2 searchForm = new Form2();
  searchForm.Show();
  }
  if (e.KeyChar == 13)
  {
  MessageBox.Show("Enter key pressed");
  }
  }

 Check .http://stackoverflow.com/questions/1707040/handling-function-key-press
0
Photo of Manoj Bhoir
NA 7.6k 294.2k 9y
Hi,
you can try KeyDown event. See this code :

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
            if (e.KeyCode == Keys.F1)
            {

            }
            if (e.KeyCode == Keys.F2)
            {

            }
            if (e.KeyCode == Keys.F12)
            {

            }
}