Browse DevX
Sign up for e-mail newsletters from DevX


Tip: Quick Way to Disable Copy-Paste in a Textbox in a WinForms Application

Learn how to disable copy/paste, and other shortcuts, in newer versions of .NET.


In the old versions of .NET, we needed to override the default context menu and override the ProcessCmdKeyfunction to return True to disable Copy-Paste of content into textboxes through keys such as Ctrl+C, Ctrl+V, Shift+Insert, etc.

In the newer versions of .NET, we can just disable the "ShortcutsEnabled" property to False. This will do the trick. You can no longer copy/paste or perform any other actions through shortcuts on the textbox.


Visit the DevX Tip Bank


Srinath M. S. says: "I would love to leave a footprint in this flat world."
Thanks for your registration, follow us on our social networks to keep up-to-date