On a KeyPressEvent I know how to detect when the CTRL key is down, but then I want to get CTRL+[what?].
With CTRL+A, KeyChar = 1, CTRL+B gives 2, etc. What is the best way to detect CTRL+a input?
Here is my code:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (ModifierKeys.HasFlag(Keys.Control))
{
Console.Write("(Ctrl) ");
}
Console.WriteLine(Convert.ToString(Convert.ToInt32(e.KeyChar)));
}
Entering a, b, CTRL+a, CTRL+b gives:
97
98
(Ctrl) 1
(Ctrl) 2