I have a ListBox Populated with a bunch of items.
I want to be able to show a menu when i right click on one of the items.
I didnt find an event that handles this operation.
thx
db
Printable View
I have a ListBox Populated with a bunch of items.
I want to be able to show a menu when i right click on one of the items.
I didnt find an event that handles this operation.
thx
db
I solved it, here's how i did it
1. Add a context menu
2. Add the following to Form Load
3. Add the following subs to handle the mnuFormatX_Click eventsPHP Code:mnuContext.MenuItems.Add(New MenuItem("Format 1", New EventHandler(AddressOf mnuFormat1_Click)))
mnuContext.MenuItems.Add(New MenuItem("Format 2", New EventHandler(AddressOf mnuFormat2_Click)))
lstSource.ContextMenu = mnuContext
The Following is just to see what im doing so you get the point (it opens a spreadsheet displaying the different formats)PHP Code:Sub mnuFormat1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
OpenFormat(1)
End Sub
Sub mnuFormat2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
OpenFormat(2)
End Sub
hope this helps someone else with the same prob i hadPHP Code:Private Sub OpenFormat(ByVal intFormat As Integer)
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
oXL = CreateObject("Excel.Application")
oWB = oXL.Workbooks.Add
oWB = oXL.Workbooks.Open("C:\SpreadSheet Formats\Format " & intFormat & ".xls")
oXL.Visible = True
oXL = Nothing
oWB = Nothing
oSheet = Nothing
End Sub
daver