Results 1 to 2 of 2

Thread: Right Mouse Click in ListBox

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    Right Mouse Click in ListBox

    For some reason I could not think of how to do this and when I searched, I could not find any easy code that was not API related or some such silliness.

    To select the item that was right clicked on, use the following:

    Code:
     Private Sub ListBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseUp
            If e.Button = Windows.Forms.MouseButtons.Right Then
                ListBox1.SelectedItem = ListBox1.Items(ListBox1.IndexFromPoint(e.Location))
            End If
        End Sub
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  2. #2
    New Member
    Join Date
    Dec 2008
    Posts
    1

    Re: Right Mouse Click in ListBox

    Oh thank you so much I have been looking for this for 3 days now. Beating my head against my desk. LOL

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