In Windows Forms, most of the tools we use do not have Right Click enabled. But Textbox in Windows Forms has Right Click enabled, which some of the developers don’t like. So, if you are one of them, then here a simple and single line of code which you can use to disable this Right Click Context Menu.
- Say you have a textbox with ID textBox1, then add the following line in the Form Load Event
textBox1.ContextMenu = new ContextMenu();
- It will Re initialize your Right Click Context Menu for that textbox having no items in that menu. So, now if you try to right click on that textbox, you won’t see any Right Click Context Menu.
Incoming search terms:
- block left click blokkeren c# (1)
- disabling the past in a c# textbox (1)