Function Key Press(F1,F2 ....F2) OPen Window Form
Window application C# Function Key Press(F1,F2 ....F2) OPen Window Form
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipankar BiswasPosted May 11, 2015, 10:58 AM
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
Manoj BhoirPosted May 11, 2015, 9:54 AM
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)
{
}
}