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. Selecting items in the ListView Control

Selecting items in the ListView Control

Scheduled Pinned Locked Moved Visual Basic
question
4 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
    cpod
    wrote on last edited by
    #1

    I am working on an app that allows me to enter items into a listview control, I also would like to add a image to that particular item how can I do that using the select case function? Or is there another way to do that? Also I want to be able to double click on any item in the listview control and it will display information about the selected item. I have been having trouble selecting item from the ListView control using Select Case. Can you please let me know what I am doing wrong…. Thanks :confused: Thanks cPod....

    C 1 Reply Last reply
    0
    • C cpod

      I am working on an app that allows me to enter items into a listview control, I also would like to add a image to that particular item how can I do that using the select case function? Or is there another way to do that? Also I want to be able to double click on any item in the listview control and it will display information about the selected item. I have been having trouble selecting item from the ListView control using Select Case. Can you please let me know what I am doing wrong…. Thanks :confused: Thanks cPod....

      C Offline
      C Offline
      carlos_rocha
      wrote on last edited by
      #2

      Hi! 1 - Concerning adding items and associating an image to them you could associate an ImageList to the smallImageList or largeImageList property of the class and then when you're creating the items do: myListView.Items.Add(New ListViewItem("blablabla", myImageIndex)) myImageIndex is the imageList index of the image you whish to show in the item. 2- To show Info about ONE selected item you have to put this code in the doubleClick event of the Listview: myListView = CType(sender,ListView) ListViewSelectedText = myListView.SelectedItems(0).Text With this you're getting the text of the item.You can also have for example some info in the tag property... ListViewSelectedTag = myListView.SelectedItems(0).Tag NOTE: If you have the multiselect property active then you'll have to iterate through the selectedItems collection and get the info you need Never say never

      C 1 Reply Last reply
      0
      • C carlos_rocha

        Hi! 1 - Concerning adding items and associating an image to them you could associate an ImageList to the smallImageList or largeImageList property of the class and then when you're creating the items do: myListView.Items.Add(New ListViewItem("blablabla", myImageIndex)) myImageIndex is the imageList index of the image you whish to show in the item. 2- To show Info about ONE selected item you have to put this code in the doubleClick event of the Listview: myListView = CType(sender,ListView) ListViewSelectedText = myListView.SelectedItems(0).Text With this you're getting the text of the item.You can also have for example some info in the tag property... ListViewSelectedTag = myListView.SelectedItems(0).Tag NOTE: If you have the multiselect property active then you'll have to iterate through the selectedItems collection and get the info you need Never say never

        C Offline
        C Offline
        cpod
        wrote on last edited by
        #3

        Is it possible to bind images from a database into a ListView Control? Thanks Thanks cPod....

        C 1 Reply Last reply
        0
        • C cpod

          Is it possible to bind images from a database into a ListView Control? Thanks Thanks cPod....

          C Offline
          C Offline
          carlos_rocha
          wrote on last edited by
          #4

          Hi! I've never done that but maybe you should check out the bindingContext property. Sorry i can't give you any more help. Never say never

          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