Can anyone explain why the check for Alt+Left Arrow key is triggered on a Alt+Right Arrow key press within the ProcessCmdKey method? When I originally coded this method, everything worked. I am beginning to question all my key handlers, but wanted to know if there was a good explaination or if I am missing something. All other key combinations work as expected.
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
If (keyData And Keys.Alt) = Keys.Alt Then
If (keyData And Keys.Left) = Keys.Left Then
'when Alt+Right key is pressed
' this executes, except when a breakpoint is set anywhere within this method
' this still executes in released code
Debug.WriteLine("WTF!")
End If
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
The work around is to check for the key press as If keyData = (Keys.Alt Or Keys.Left) Then
[update] Ah, I got it. Thank you Mitch. I did check for that, but missed it.
? convert.ToString(Keys.Left, 2)
"100101"
? convert.ToString(Keys.Right,2)
"100111"
Still would like to know why hitting the breakpoint changes behavior.
[update] Thank you again Mitch. Since it wasn't reproducible for you, I suspect the solutions .suo file is corrupt. I deleted this file and now hitting the breakpoint has no affect.