Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. List Box / Combo Box

List Box / Combo Box

Scheduled Pinned Locked Moved Visual Basic
databasecomtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Riaz Ahmed
    wrote on last edited by
    #1

    Hi I want to access the items added in the list box or combo box on right click. Example List box contains: ITEM(0)"First" ITEM(1)"Second" ITEM(2)"Third" values have been populated and program is running now i "Right Click" on list box what i want , the index number of the item on which mouse was Right clicked. Thanx in anticipation

    Riaz Ahmed 0300-2668545 Software Engineer DCCTechnologies riaz.ahmed@dcc.com.pk

    A 1 Reply Last reply
    0
    • R Riaz Ahmed

      Hi I want to access the items added in the list box or combo box on right click. Example List box contains: ITEM(0)"First" ITEM(1)"Second" ITEM(2)"Third" values have been populated and program is running now i "Right Click" on list box what i want , the index number of the item on which mouse was Right clicked. Thanx in anticipation

      Riaz Ahmed 0300-2668545 Software Engineer DCCTechnologies riaz.ahmed@dcc.com.pk

      A Offline
      A Offline
      Ajay k_Singh
      wrote on last edited by
      #2

      On mouse up event of list box you can use IndexFromPoint method to get index of item which has been clicked. This index can be used to retrieve the actual listbox item, such as – ------------------------------------------ Private Sub ListBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseUp Dim ItemName As String If e.Button = Windows.Forms.MouseButtons.Right Then ItemName = Me.ListBox1.Items.Item(Me.ListBox1.IndexFromPoint(e.X, e.Y)).ToString() MessageBox.Show(ItemName) End If End Sub ------------------------------------------- I hope this helps :) . -Dave.

      ------------------------------------ http://www.componentone.com ------------------------------------

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups