Populate popup menu with contents of listbox and recognize when item is clicked.
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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Rate Populate popup menu with contents of listbox and recognize when item is clicked.
(2(2 Vote))
'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
Populate popup menu with contents of listbox and recognize when item is clicked. Comments
No comments yet — be the first to post one!
Post a Comment