I have several textboxes on a windows form.
I can't paste text into any of them using CTRL-V, though I can still right click and select paste. This is pretty annoying.
I have tried this with the form's KeyPreview as both true and false. TextBox.ShortcutsEnabled is also true.
Make sure that yourTextBox. ShortcutsEnabled is set to true . Note that if ShortcutsEnabled is false this also suppresses the standard context menu of the TextBox control, which would prevent pasting using the mouse.
In WinForms, the easiest way to disable cut, copy and paste features on a textbox is to set the ShortcutsEnabled property to false.
Set ShortcutsEnabled property to False . This will disable Cut, Copy and Paste.
This property is used to set a value which shows whether pressing ENTER in a multiline TextBox control creates a new line of text in the control or activates the default button for the given form.
Check to see if you have a menu on the form with a shortcut for Ctrl-V.
The following code should help:
private void textBox1_KeyUp(object sender, KeyEventArgs e) {
if (e.KeyData == Keys.V && e.Modifiers == Keys.Control)
(sender as Textbox).Paste();
}
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