0

I´ve got multiple buttons that need to be accessed through KeyDown events in a Windows Form.

I´ve set up some of them without any problems, but when setting the KeyCode to Keys.LShift it just doesn´t fire. (just changing LShift to C works like a charm)

As im able to write this in capital letters I´m certain that my keyboard works fine

Is the Shift key handled differently in any way?

this is my setup:

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {

            if (e.KeyCode ==Keys.LShiftKey)
            {
                //code doesnt fire
            }

             if (e.KeyCode == Keys.Q)
            {
                //works without problem
            }
        }

Edit: Meant LShiftKey

thrieks
  • 1
  • 2
  • This might be relevant: https://stackoverflow.com/questions/3172731/forms-not-responding-to-keydown-events – Klaus Gütter Jun 06 '23 at 12:50
  • You mean LShiftKey right? There is no Keys.LShift. – Ralf Jun 06 '23 at 12:53
  • Just tried it looks like the Key handling in forms does not distinguish Left&Right Shift. You get the Key Events but just for Shift without the distinction. – Ralf Jun 06 '23 at 13:08
  • https://stackoverflow.com/questions/2569268/net-difference-between-right-shift-and-left-shift-keys – dr.null Jun 06 '23 at 15:17

0 Answers0