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. C#
  4. Extracting subitems from a listview?

Extracting subitems from a listview?

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

    I've got a listview control on a windows form. The listview is loaded with data. Is there a way to get the string data from each subitem when the user clicks on a row in the listview? For example: row 3 in the listview has Smith, John, and 22-3333-53 in it. I'd like to get the strings Smith, John, and 22-3333-53 returned from the listview. Is this possible? I haven't seen a thing on the code project about it. Thanks

    S 1 Reply Last reply
    0
    • M Manster

      I've got a listview control on a windows form. The listview is loaded with data. Is there a way to get the string data from each subitem when the user clicks on a row in the listview? For example: row 3 in the listview has Smith, John, and 22-3333-53 in it. I'd like to get the strings Smith, John, and 22-3333-53 returned from the listview. Is this possible? I haven't seen a thing on the code project about it. Thanks

      S Offline
      S Offline
      shaunAustin
      wrote on last edited by
      #2

      Yep!!! Each ListViewItem in the ListViewItemsCollection (myListView.Items) has a SubItems collection too... :-D You just do string Surname = listView.Items[2].Text; string Forename = listView1.Items[2].SubItems[0].Text string Phone = listView1.Items[2].SubItems[1].Text HTH Cheers :-D Shaun

      M 1 Reply Last reply
      0
      • S shaunAustin

        Yep!!! Each ListViewItem in the ListViewItemsCollection (myListView.Items) has a SubItems collection too... :-D You just do string Surname = listView.Items[2].Text; string Forename = listView1.Items[2].SubItems[0].Text string Phone = listView1.Items[2].SubItems[1].Text HTH Cheers :-D Shaun

        M Offline
        M Offline
        Manster
        wrote on last edited by
        #3

        Thanks a lot for your help! :)

        S 1 Reply Last reply
        0
        • M Manster

          Thanks a lot for your help! :)

          S Offline
          S Offline
          shaunAustin
          wrote on last edited by
          #4

          No probs... :-D Any time!!! ;)

          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