Results 1 to 3 of 3

Thread: Reading Items from a Listview

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    52

    Question Reading Items from a Listview

    Does anyone know how to read items out of a listview? I have tried to loop through but I am getting an error. Here is the code that I have been using:

    VB Code:
    1. Dim Item as ListViewItem
    2.  
    3. For Each Item in ListView1.Items
    4.      MsgBox (Item.Text)
    5.      MsgBox (Item.SubItems.Item(Item.Index).Text)
    6. Next

    I am trying to export the contents of a listview to a text file. Does anyone have any ideas on how to get this to work?

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Instead of
    Code:
                MsgBox (Item.SubItems.Item(Item.Index).Text)
    try
    Code:
                MsgBox(Item.SubItems(0).Text)

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    52
    Thanks alot, that works fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width