Results 1 to 3 of 3

Thread: Adding subitems to a listview

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Adding subitems to a listview

    I am not to familiar with VB 6 so forgive
    .
    I am using the following to add a second column :
    Code:
     Set item = listView.ListItems.Add(, , "AAA")
    item.SubItems(1) = "BBB"
    But the second line keeps giving me "Invalid property value".

    Any ideas what I am doing wrong ?

    TIA

    Parksie

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Adding subitems to a listview

    When in doubt, Read That Fine Manual:

    Code:
        With ListView1
            With .ColumnHeaders
                'Since we want subitems, we must "add headers" for the number
                'of columns we want.  SubItems is a pseudo-array-like collection
                'property, not actually an array.  Quoting the manual:
                '
                '   "You cannot add elements directly to the subitems array. Use
                '   the Add method of the ColumnHeaders collection to add subitems."
                .Add
                .Add
            End With
            With .ListItems.Add(, , "AAA")
                .SubItems(1) = "BBB" 'Success!
            End With
        End With

  3. #3
    gibra
    Guest

    Re: Adding subitems to a listview

    Why open a NEW thread, for same problem, instead to continue the previous???

    http://www.vbforums.com/showthread.p...y-ListViewItem

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