Hello guys!
I have to capture the following keyboard event in a TextBox - SHIFT + 8(on the numpad). This also means the NumLock will be on. When I try the following SHIFT + UP is not printed:
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Shift && e.KeyCode == Keys.NumPad8)
Console.WriteLine("SHIFT + UP");
Console.WriteLine(e.KeyCode);
Console.WriteLine(e.KeyData);
Console.WriteLine();
}
But CTRL + 8(on the numpad) is working.
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.NumPad8)
Console.WriteLine("CTRL + UP");
}
Update: The following is printed, on a single SHIFT + 8 press:
ShiftKey
ShiftKey, Shift
Up
Up
ShiftKey
ShiftKey, Shift
Could someone explain me, why SHIFT + 8 isn't fired, but CTRL + 8 is working?
P.S. I wrote + UP, because the user wants to navigate with the numpad arrows and the SHIFT key, but his NumLock will also be on. That's why I catch Keys.NumPad8.
All the best, Petar