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. How to select an Item in a Listview

How to select an Item in a Listview

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
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.
  • C Offline
    C Offline
    code_gopher
    wrote on last edited by
    #1

    I have a listview in details mode, and I want to be able to double click on it and a varaiable return with the information that I click on. Is this possible? Thanks in advance Code_Gopher

    M 1 Reply Last reply
    0
    • C code_gopher

      I have a listview in details mode, and I want to be able to double click on it and a varaiable return with the information that I click on. Is this possible? Thanks in advance Code_Gopher

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Would something like this work? (Assuming a control on the form called ListView1)

      Private Sub ListView1\_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) \_
                    Handles ListView1.DoubleClick
      
          '-- get the item selected following the double-click
          Dim sel As ListViewItem
          sel = ListView1.SelectedItems(0)
          
          '-- display the selected item text
          If Not (sel Is Nothing) Then
              MessageBox.Show(sel.Text)
          End If
      End Sub
      
      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