Click here to Skip to main content
15,921,295 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a menu strip in my form.
when i press the Alt+F7 key ,show another form
how it Possible
pls help me

thanks in advance
Posted

I would use KeyDown event instead of KeyPress. Here is an example.

C#
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.F7)
    {
        MessageBox.Show("Hello!");
    }
}


Of course instead of MessagBox you will want to show your form. :)
 
Share this answer
 
v2
set the ShortcutKeys property to Alt+F7 and write this:

C#
private void yourToolStripMenuItem_Click(object sender, EventArgs e)
        {
           Form2 frm2 = new Form2();
            frm2.ShowDialog(); 

        }


hope it helps :)
 
Share this answer
 
Comments
LanFanNinja 7-Feb-12 0:44am    
+5 Why didn't I think of that? :)
Uday P.Singh 7-Feb-12 0:47am    
thank you :)

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