
Originally Posted by
jmcilhinney
First up, you should use this:
vb.net Code:
If e.KeyData = (Keys.Control Or Keys.P) Then
rather than this:
vb.net Code:
If e.Control = True And e.KeyCode = Keys.P Then
That's because the first snippet will trap only Ctrl+P while the second will also trap Ctrl+Shift+P, Ctrl+Alt+P and Ctrl+Alt+Shift+P.
That is exactly why I think he should use
vb.net Code:
If e.Control = True And e.KeyCode = Keys.P Then
and not
vb.net Code:
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.