Menu.MenuItemCollection(Menu) Constructor

Definition

Initializes a new instance of the Menu.MenuItemCollection class.

public:
 MenuItemCollection(System::Windows::Forms::Menu ^ owner);
public MenuItemCollection (System.Windows.Forms.Menu owner);
new System.Windows.Forms.Menu.MenuItemCollection : System.Windows.Forms.Menu -> System.Windows.Forms.Menu.MenuItemCollection
Public Sub New (owner As Menu)

Parameters

owner
Menu

The Menu that owns this collection.

Remarks

This class requires that you associate the collection with a class that derives from Menu, such as the MainMenu, ContextMenu, or MenuItem class. Since you must specify a menu that is associated with this collection, you cannot create multiple menu item collections and associate them with a menu as needed. In order to switch the menu items associated with a menu, you must clear the collection of items and add the menu items to display to the collection.

Applies to

See also