Link to home
Start Free TrialLog in
Avatar of czfdragon
czfdragon

asked on

How to disable the default mouse right click menu on a text box ?

hello!
How to disable the default  right click menu of the mouse  on a text box in vb.net?
i really need your help.
thank you!
Avatar of chad
chad

I just added a contextmenustrip from the toolbox and set the properties of the textbox to use that menu.  

with the contextmenustrip you can build your own right click menu for any control on a form.
hth
K
I know 2005 has the options to add and build a context menu strip (right click menu) from the toolbox.  But if you need to do it via code
http://msdn2.microsoft.com/en-us/library/system.windows.forms.contextmenustrip.aspx

 
Avatar of czfdragon

ASKER

first thank you .
i am sorry.
i may have misunderstood you.
my means is that when i put the mouse on the textbox and right click the mouse ,the menu(copy,delet,paste such as ) is disabled.
It is said that copy,delete such as will not be used.
can you understand me?
If you do not want to allow the user to perform delete, paste and cut you can set the ReadOnly property of the textbox to True. As for copy, you might want to check the keypress event for that.
i am sorry again.
The textbox is editable,so i cann't set the readonly property of the textbox.
i need your help!
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
as far as my first comment regarding the context menu strips... if you add one to the form and assign it to the textbox without designing or adding any menu items it will in effect do what you are looking for.
if the user right clicks on the textbox absolutely nothing will happen.  No menu will be shown.

I am sure there is a cleaner option to do the same thing and I will look into it but this will work.
thanks for everyone!
And sepecial thanks for TheLearnedOne .Your help is my inneed.