2

i've got problem. If I push one key I can get event for example:

if (e.KeyCode == Keys.F4)
            {
                Method();
            }

How could I do the same if I push two keys? For example Enter + F4?

BKl
  • 415
  • 1
  • 8
  • 23
  • Do you mean simultaneously, or press and release one, then the other? – Jon Skeet Jan 18 '12 at 09:52
  • if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) <<--- it is the answer like Mujassir Nasir has written below. thank you all for help! – BKl Jan 18 '12 at 10:04

1 Answers1

0
    FormLoad()
{
   this.KeyPreview = true;
   this.KeyDown += new KeyEventHandler(Form1_KeyDown);
}

void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            //Works for Ctrl+F4
            if (e.Control && e.KeyCode == Keys.F4)
            {
                //Do something
            }
        }

See if this work for you.

A.P.S
  • 1,124
  • 4
  • 17
  • 36