I have a listBox that my users will right-click on an item in the box and I want to present them 2 options...
Option 1 or Option 2
Option 1 does some piece of code, option 2 does some other bit of code...
What is the best way to do that?
Thanks!
Printable View
I have a listBox that my users will right-click on an item in the box and I want to present them 2 options...
Option 1 or Option 2
Option 1 does some piece of code, option 2 does some other bit of code...
What is the best way to do that?
Thanks!
use the PopupMenu
1. create a menu with two submenus
2. put anything in your two menus (code that is...)
3. hide the menu
4. in the ListBox MouseDown event... put this code
[Edited by rod on 09-07-2000 at 12:18 AM]Code:Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu mnuMymenu 'mnuMyMenu is the name of your menu
End If
End Sub
That worked perfectly, thank you!!
One more question...
Since there may be several items in the list box, how can I tell which one the user right-clicked on?
lstListBox.ListIndex doesn't do it because a right-click doesn't actually select anything in the box...