Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I have provided a help for my program and i want to press F1 for running helps form.
what should I do?
could someone give me a code!
best regards.
Posted
Updated 13-Sep-11 7:11am
v2

C#
private void Form1_Load(object sender, EventArgs e)
{
    this.KeyPreview = true;
    this.KeyDown += new KeyEventHandler(Form1_KeyDown);
}

void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode.ToString() == "F1")
    {
        // the user pressed the F1 key
    }
}
 
Share this answer
 
Handle the KeyPress event in your form and check for F1 and bring up your help from there.
 
Share this answer
 
Comments
shiny1366 13-Sep-11 13:31pm    
what does it mean?
"..check for F1.."

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900