473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to disable Form's Context menu in C# windows forms

language using: C#.

platform for program: WINDOWS FORM

I wnt to disable the right click for text boxes.And also want to diable the context menu.

I have already disable the Minimize and maximizsed buttons from the form properties and set the form border style to fix dialog but still on right click of mouse, the context menu for close and move is cming.
Jan 29 '08 #1
5 22843
radcaesar
759 Expert 512MB
To prevent the default context menu of a TextBox from showing up, assign it as empty

textBox1.ContextMenu = new ContextMenu();
Jan 29 '08 #2
Plater
7,872 Expert 4TB
Remove the control box from the form and you won't get the close/move context menu. I have never seen it come from a right-click though.

You could also try setting a custom empty context menu to the form and such?
Jan 29 '08 #3
Remove the control box from the form and you won't get the close/move context menu. I have never seen it come from a right-click though.

You could also try setting a custom empty context menu to the form and such?
Thnks a lot.Its working for textbox.But when i was trying to apply same method to disable the context menu of the form,this method is not working..why so??

this.ContextMenu = new ContextMenu();

Is there any other way to disable form's ContextMenu?
Jan 30 '08 #4
language using: C#.

platform for program: WINDOWS FORM

This method of assigning empty context menu is not working for Form ,why so?
textbox.ContextMenu = new ContextMenu ();

I have tried as below

this.ContextMenu = new ContextMenu ();

But its not wrking

Do you know any method to disable context menu of from?
Jan 30 '08 #5
Plater
7,872 Expert 4TB
EDIT: Please don't double post, you already had the question here.

My forms don't have a context menu, so I am unsure what you are getting at.
They have a controlbox menu though, which I think you can disable by changing the formborderstyle (and maybe the same way you do with max/min)
Jan 30 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ThunderMusic | last post by:
Hi, I'm trying to have a MSN Messenger like form/app closing behavior. When I click on the X button, I only want the form to disappear and when I double-click on the notify icon or right-click...
4
by: Bilo | last post by:
I have a Windows Forms Class MainGUI I have declared MainGUI maingui; public System.ComponentModel.Container components = new Container(); in the Class I call another class MediaDriver with...
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
13
by: Steven Smith | last post by:
Just a quick question... I've built a context menu which I want to pop-up when right clicking the form, I've set the Form's context menu property to the name of the menu in question, but it...
3
by: Robert | last post by:
I have downloaded the demo from MS. There is this code in the control: ' Enable or disable IE's context menu? This allows the parent host ' to render its own. Public Property...
6
by: PradeepKel | last post by:
Hi, I have 3 forms in my application. Form1 which is a MDI form calling Form2 & Form3. Form2 has a textbox "TextBox1" and Form3 has a CommandButton "Button1". I will show both Form1 & Form2 as...
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
0
by: Newbie Coder | last post by:
I have added a context menu to a user control with just copy/paste on it. This is set for all areas of my user control, but when compiled, added to a Windows form the context menu doesn't show....
6
by: jojoba | last post by:
Hi, I am trying to create a .net webservice such that: When a user calls the service, the server creates a System.Windows.Forms.Form and shows it on the server screen. I know this sounds...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.