Tuesday, April 21, 2009

Disable Textbox Right Click Context Menu

Earlier today I had a requirement to disable right click context menu inside a TextBox Control. Though the solution looked simple at hindsight, it did seem cheeky.

All you needed to do was to add a Context Menu to you Form and attach this as the Context Menu for your Text Box Control. And that is all you need to think about !!

What happens is when you are not specifying any Context menu explicitly, Windows default Context menu gets attached to your control. By overriding it with another empty menu control, you are denying the default one an appearance.

Simple as it can get.