I want to handle the ctrl + c keys in keydown event but it is not working. I am trying this code but not working. when I print e.keycode, I see it as "Controlkey" but I am pressing Ctrl + C. I tried for ALT + A. It is working and e.keycode is coming as "A" key. And I tried to code in this link: Link is here. But didn't work again.
My code (if key is Ctrl+ C, e.keycode = Controlkey ):
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.C)
{
Console.WriteLine("work please");
}
}
I tried this code for another project, and it works but now I am writing again and it doesn't. How can solve it?
Edit: It is working for this code (if key is Alt + C, e.keycode = A ) :
if (Control.ModifierKeys == Keys.Alt && e.KeyCode == Keys.C)
{
Console.WriteLine("work please");
}