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. Vb.Net - ListView - display items

Vb.Net - ListView - display items

Scheduled Pinned Locked Moved Visual Basic
csharpsalesquestioncareer
3 Posts 3 Posters 1 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
    Central_IT
    wrote on last edited by
    #1

    I have a listview with values Salary Name Department 2000 Peter Accounts 1000 Anne Sales If I want the salary, I have the following code that works MsgBox(lvwListView.SelectedItems(0).Text) This gives me a value of 2000. What is the code if I want to display their Name or the Department instead of salary

    L A 2 Replies Last reply
    0
    • C Central_IT

      I have a listview with values Salary Name Department 2000 Peter Accounts 1000 Anne Sales If I want the salary, I have the following code that works MsgBox(lvwListView.SelectedItems(0).Text) This gives me a value of 2000. What is the code if I want to display their Name or the Department instead of salary

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Use the SubItems collection of the ListViewItem[^].

      I must get a clever new signature for 2011.

      1 Reply Last reply
      0
      • C Central_IT

        I have a listview with values Salary Name Department 2000 Peter Accounts 1000 Anne Sales If I want the salary, I have the following code that works MsgBox(lvwListView.SelectedItems(0).Text) This gives me a value of 2000. What is the code if I want to display their Name or the Department instead of salary

        A Offline
        A Offline
        Ants Hurdley
        wrote on last edited by
        #3

        Try changing the selected items to 2 ie MsgBox(lvwListView.SelectedItems(2).Text) You should also be able to refer to the name of the field ie MsgBox(lvwListView.SelectedItems("Department").Text) Cheers Ants

        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