Results 1 to 3 of 3

Thread: ListView HELP!

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    63

    ListView HELP!

    2 Questions:

    1. Tooltips only seem to work over items in my list view when the view type is set to lvwReport.

    2. What is the .ListSubItems property used for?

    Any help and ideas appreciated.

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736

    ListSubItems

    ListSubItems is used to add data into columns in the listview. The code below is from MSDN to show how to loop through and use the ListSubItems. I use the listView along with listSubItems to read data in from a table and place the data in the listView in rows.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.    Dim i As Integer ' Counter
    5.    Dim j As Integer ' Counter for ListSubItems
    6.    Dim sngWidth As Single
    7.    Dim si As ListSubItem
    8.    Dim li As ListItem
    9.  
    10.    ' You can't see ColumnHeaders or ListSubitems
    11.    ' unless the View is set to lvwReport.
    12.    ListView1.View = lvwReport
    13.  
    14.    ' Calculate the width of a ColumnHeader object.
    15.    sngWidth = ListView1.Width / 5
    16.  
    17.    ' Create five ColumnHeader objects.
    18.    For i = 1 To 5
    19.       ListView1.ColumnHeaders.Add Text:="Col " & i, Width:=sngWidth
    20.    Next i
    21.    
    22.    ' Create twenty ListItem objects. For each ListItem, create four
    23.    ' ListSubItem objects. Set the ForeColor for each object to red.
    24.    For i = 1 To 20
    25.       Set li = ListView1.ListItems.Add(Text:="Item " & i)
    26.       For j = 1 To 4
    27.          Set si = li.ListSubItems.Add(Text:="Subitem " & j)
    28.          si.ForeColor = vbRed
    29.       Next j
    30.    Next i
    31. End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    63

    .ListSubItems

    I basically use the .SubItems proerty for this. So whats the difference between the .ListSubItems and .SubItems?

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