Merges this menu item with another menu item.
Merges another menu item with this menu item.
[Visual Basic] Overloads Shadows Public Sub MergeMenu(MenuItem)
[C#] public new void MergeMenu(MenuItem);
[C++] public: new void MergeMenu(MenuItem*);
[JScript] public new function MergeMenu(MenuItem);
Merges this menu item with another menu item and returns the resulting merged TBD.
[Visual Basic] Overloads Overridable Public Function MergeMenu() As MenuItem
[C#] public virtual MenuItem MergeMenu();
[C++] public: virtual MenuItem* MergeMenu();
[JScript] public function MergeMenu() : MenuItem;
The following example uses this version of the TBD method to create a copy of a menu item and merge it with another. This example assumes that there are two menu items called MenuItem1 and MenuItem2 that contain submenu items within them and a MainMenu called MainMenu1 to display the menu items. MenuItem1 and MenuItem2 have different menu items contained within them. After the call to TBD is made, a consolidated menu is created but MenuItem1's menu items are not changed.
Note This example shows how to use one of the overloaded versions of MergeMenu. For other examples that may be available, see the individual overload topics.
Public Sub MergeMyMenus() ' Create a copy of my menu item. Dim TempMenuItem = New MenuItem() ' Create a copy of MenuItem1 before doing the merge TempMenuItem = MenuItem1.MergeMenu ' Merge MenuItem1's copy with MenuItem2 MenuItem2.MergeMenu(TempMenuItem) End Sub
MenuItem Class | MenuItem Members | System.WinForms Namespace