Function Key Press(F1,F2 ....F2) OPen Window Form
Window application C# Function Key Press(F1,F2 ....F2) OPen Window Form
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manoj BhoirRank #599 · 4K reputationPosted May 11, 2015, 5:54 AM EDT
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)
{
}
}
Dipankar BiswasRank #992 · 2K reputationPosted May 11, 2015, 6:58 AM EDT
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