I have set visible property of my menuStrip1 items to false as
foreach (ToolStripMenuItem itm in menuStrip1.Items)
{
itm.Visible = false;
}
Now I know the Names of toolStripMenuItem and dropDownItem
of the menustrip1. How to can I activate the required toolStripMenuItem and dropDownItem
.
I have
string mnItm = "SalesToolStripMenuItem";
string ddItm = "invoiceToolStripMenuItem";
Now I want to set visible true to these two(toolStripMenuItem and dropDownItem
) items. How can I do that? I know those names only.
You should try something like this:
Initialize
strControlVal
string on your discretion where you need it.Simply use those names to get the actual
item
viaMenuStrip.Items
indexer:You can use
or if you want to set Visible to multiple toolstrip items:
Hope it helps
You're looking for ToolStripItemCollection.Find method.
second parameter says whether or not to search the childrens.
If i get your question you are trying to disable other than the above two mentioned toolstrip items. Since you know the name of the menu items a slight change in code can get you along