Aijaz Chauhan
Aijaz Chauhan

Reputation: 1659

How to disable any particular menu in windows application?

Please check below screen shot

enter image description here

For Example:

I am having a String. Value of that string is "Bank" I need some logic that disable the menu with name "Bank"

I hope you got my question.

Upvotes: 0

Views: 618

Answers (4)

Aijaz Chauhan
Aijaz Chauhan

Reputation: 1659

I have solved my question

Answer is like below

 foreach (ToolStripMenuItem d in fileToolStripMenuItem.DropDownItems)
 {
    if (d.Name == "saveToolStripMenuItem")
    {
       d.Enabled = true;
    }
 }

Upvotes: 0

adopilot
adopilot

Reputation: 4520

Can you find name of your menu ITEM inside menu.Open Form in design view select your menu item and hit F4 (to get properties window) on properties you should be able to see name of your item. You can try hide that on properites menu. Or you need somewhere in code behind to do that through code.

Here is ss of itenter image description here

Upvotes: 0

Sudhakar Tillapudi
Sudhakar Tillapudi

Reputation: 26209

You need to just set the Enabled property of your menuItem Zone to false

Try This:

yourMenuItem.Enabled = false;

here yourMenuItem is the name of the menu item zone

Upvotes: 0

ohlmar
ohlmar

Reputation: 956

Since your question is VERY vague, this answer might be wrong. But what I think you want is to disable a menu item at certain times.

 menuitem.IsEnabled = false;

Upvotes: 1

Related Questions