After creating the menu, we will add the listbox and write the code to insert items in the listbox.
Add a ListBox. Leave the name listbox1. Make sure the top is below the menu and make it a bit bigger.
(We will add code to resize the listbox when the form is resized later.)
Write the code as shown below:
Private Sub mnuInsert_Click(sender As Object, e As EventArgs) Handles mnuInsert.Click
'Add an item to the list box
Dim s As String
s = InputBox("Enter item", "Add Item")
If s <> "" Then
ListBox1.Items.Add(s)
End If
End Sub
See the
complete code at this point.