(Print this page)

Nice tip: Preventing copy/paste from WinForms textboxes
Published date: Wednesday, July 12, 2017
On: Moer and Éric Moreau's web site

I just found a really cool nice tip on http://www.devx.com/tips/dot-net/quick-way-to-disable-copy-paste-170320075010.html.

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.


(Print this page)