Results 1 to 2 of 2

Thread: Capture Right Click in ListBox [RESOLVED]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124

    Capture Right Click in ListBox [RESOLVED]

    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
    Last edited by daveStudent; Jul 24th, 2003 at 09:15 AM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124
    I solved it, here's how i did it


    1. Add a context menu
    2. Add the following to Form Load
    PHP 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 
    3. Add the following subs to handle the mnuFormatX_Click events
    PHP Code:
    Sub mnuFormat1_Click(ByVal sender As ObjectByVal e As System.EventArgs)
            
    OpenFormat(1)
        
    End Sub
        Sub mnuFormat2_Click
    (ByVal sender As ObjectByVal e As System.EventArgs)
            
    OpenFormat(2)
        
    End Sub 
    The Following is just to see what im doing so you get the point (it opens a spreadsheet displaying the different formats)

    PHP 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 
    hope this helps someone else with the same prob i had


    daver

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width