How to: Hide ToolStripMenuItems
Hiding menu items is a way to control the user interface of your application and restrict user commands. Often, you will want to hide an entire menu when all of the menu items on it are unavailable. This presents fewer distractions for the user. Furthermore, you might want to both hide and disable the menu or menu item, as hiding alone does not prevent the user from accessing a menu command by using a shortcut key.
To hide any menu item programmatically
Within the method where you set the properties of the menu item, add code to set the Visible property to
false
.MenuItem3.Visible = False
menuItem3.Visible = false;
menuItem3->Visible = false;
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET Desktop feedback