How To Ideas | How To Articles | How To Tutorials


0

How To Disable Right Click In C# Textbox


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.
image

Instructions:

  1. Say you have a textbox with ID textBox1, then add the following line in the Form Load Event
    textBox1.ContextMenu = new ContextMenu();
  2. 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)
Filed in: C# Tags: , , , , , , , , , ,

Leave a Reply

Submit Comment



© 4703 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.