Question: C#: In the keydown event of a textbox, how do you detect currently pressed modifiers + keys?

I did the following, but I'm not too familiar with these operators so I'm not sure if and what I'm doing wrong.

```
    private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Modifiers == (Keys.Alt || Keys.Control || Keys.Shift))
        {
            lbLogger.Items.Add(e.Modifiers.ToString() + " + " +
                "show non-modifier key being pressed here");
        }
    }

```

1) How would I check if e contains any modifier keys?

Answer: 
according to msdn [linkt](http://support.microsoft.com/kb/839201)

```
private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Alt || e.Control || e.Shift))
        {
            lbLogger.Items.Add(e.ToString() + " + " +
                "show non-modifier key being pressed here");
        }
    }

```
The [documentation](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.modifierkeys.aspx) says it is a bitwise combination, but you're doing a logical OR. 

Try:

```
if (e.Modifiers & (Keys.Alt | Keys.Control | Keys.Shift))
{
    lbLogger.Items.Add(e.Modifiers.ToString() + " + " +
        "show non-modifier key being pressed here");
}

```

And I think you can get the actual key with e.KeyCode.ToString().