Edit

Share via


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