Menu.MenuItemCollection.Add Method (String)
Adds a new MenuItem, to the end of the current menu, with a specified caption.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following code example uses the derived class MainMenu to create a main menu, mainMenu1, that has two MenuItem objects added to its MenuItems collection. The code then assigns mainMenu1 to the Menu property of the Form. This example requires that the code defined in this example is located with in a form.
Private Sub InitializeMyMainMenu() ' Create the MainMenu. Dim mainMenu1 As New MainMenu() ' Use the MenuItems property to call the Add method ' to add two new MenuItem objects to the MainMenu. mainMenu1.MenuItems.Add("&File") mainMenu1.MenuItems.Add("&Edit") ' Assign mainMenu1 to the form. Me.Menu = mainMenu1 End Sub
Available since 1.1