Q:

C# Detect Key Press, avoid non-typing keys

Is there any way to proceed into a method if the key that is being pressed does not result in any typing. i.e. the shift key, control key etc without having to specify all of them. Ideally, to detect combinations of keys, for example Control+V = Paste.
Code similar to below is what I am working with;
    if( (e.KeyData == Keys.Left) 
        || (e.KeyData == Keys.Right) 
        || (e.KeyData == Keys.Home) 
        || (e.KeyData == Keys.End) 
        || (e.KeyData == Keys.Up) 
        || (e.KeyData == Keys.Down)
        || (e.KeyData == Keys.ShiftKey)
        || (e.KeyData == Keys.ControlKey)
        ) return;

But don't want to add every single combination of keypresses.
Any ideas?

A:

protected override bool ProcessCmdKey( ref Message msg, Keys keyData )
{
  if ( keyData == (Keys.Control | Keys.V) )
    return true;
  else
    return base.ProcessCmdKey( ref msg, keyData );
}

That takes care of copy+paste.  You can override OnKeyPress as well and use the Char.IsDigit and/or Char.IsLetter (or Char.IsLetterOrDigit) if needed.  You get the idea, I don't think that a regular expression is warranted here as some others have suggested.

