Goal: A Menustrip with Copy and Paste and the user shall see the Shortcut-Keys.
Problem: If you have a MenuStrip and set the ShortcutKeys the are "catched" by the Menu but no longer by the Textboxes. This means you cannot use Ctrl+C / V in the Textboxes - only by Right-Click. If you remove the Shortcuts the Textboxes work fine.
Why is that? Whats the solution if I dont want to name the Entry "Copy______Ctrl+C"?
Example Project: http://www.file-upload.net/download-4098087/MenuBlocksSTRG.zip.html
MSDN is down ATM i found this links:
Go to File>Options>Customize Ribbon and click on the Keyboard shortcuts: Customize button. Then press Ctrl+V when the selection is in the Press new shortcut key: control and see what appears to the right of "Currently assigned to:" It should be EditPaste .
When Ctrl V or Ctrl V not working, the first and easiest method is to perform a restart of your computer. It has been proven by lots of users to be helpful. To restart your computer, you can click on the Windows menu on the screen and then click on the Power icon and select Restart from the context menu.
This should work for copy, and you can take care of paste in same way:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.C) && textBox1.ContainsFocus)
{
Clipboard.SetText(textBox1.SelectedText);
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With