Quote Originally Posted by keystone_paul View Post
That is exactly why I think he should use

vb.net Code:
  1. If e.Control = True And e.KeyCode = Keys.P Then

and not

vb.net Code:
  1. If e.KeyData = (Keys.Control Or Keys.P) Then

Quite often different combinations of Ctrl, Shift and Alt do different things and so using Keys.Control Or Keys.P limits your ability to do that.
No, the opposite is true. Using your code, SomeMethodButtonClickRuns will be executed if the user presses Ctrl+P, Ctrl+Alt+P, Ctrl+Shift+P or Ctrl+Alt+Shift+P. Using my code, the method will only be executed if the user presses Ctrl+P. If you want all four key combinations to do the same thing then your code would be OK but that would be a very rare thing and basically bad programming.

For instance, I'm typing this in Firefox and if I press Ctrl+Alt+P then nothing happens, while Ctrl+P brings up the Print dialogue. Using your code Ctrl+Alt+P would bring up the Print dialogue too.

Using code like yours you'd have to do this:
vb.net Code:
  1. If e.Control = True And e.Alt = False And e.Shift = False And e.KeyCode = Keys.P Then
or, better:
vb.net Code:
  1. If e.Control AndAlso Not e.Alt AndAlso Not e.Shift AndAlso e.KeyCode = Keys.P Then
I think:
vb.net Code:
  1. If e.KeyData = (Keys.Control Or Keys.P) Then
is a better option.