by Bryan Blake (8 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 25th March 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Populate popup menu with contents of listbox and recognize when item is clicked.
API Declarations
2. Add 2 command buttons (Command1 & Command2) & a TextBox (Text1)
3. Add the ListBox control (List1)
4. Using the menu editor create a top-level menu (name it whatever you like)
5. Using the menu editor create a submenu (mnuSubMenu).
!!!!!!!!!!!!!!!!!!!!!!Submenu must have index of 0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'2. Add 2 command buttons (Command1 & Command2) & a TextBox (Text1)
'3. Add the ListBox control (List1)
'4. Using the menu editor create a top-level menu (name it whatever you like)
'5. Using the menu editor create a submenu (mnuSubMenu).
'!!!!!!!!!!!!!!!!!!!!!Submenu must have index of 0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Private Sub Command1_Click()
List1.AddItem Text1.Text
End Sub
Private Sub Command2_Click()
If List1.ListCount > 0 Then
For i = 1 To List1.ListCount
Load mnuSubMenu(i)
strCaption = List1.List(i - 1)
mnuSubMenu(i).Caption = strCaption
Next i
mnuSubMenu(0).Visible = False
End If
End Sub
Private Sub mnuSubMenu_Click(Index As Integer)
MsgBox mnuSubMenu(Index).Caption
End Sub
No comments have been posted about Populate popup menu with contents of listbox and recognize when item is clicked.. Why not be the first to post a comment about Populate popup menu with contents of listbox and recognize when item is clicked..