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.
Printable View
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.
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:
Option Explicit Private Sub Form_Load() Dim i As Integer ' Counter Dim j As Integer ' Counter for ListSubItems Dim sngWidth As Single Dim si As ListSubItem Dim li As ListItem ' You can't see ColumnHeaders or ListSubitems ' unless the View is set to lvwReport. ListView1.View = lvwReport ' Calculate the width of a ColumnHeader object. sngWidth = ListView1.Width / 5 ' Create five ColumnHeader objects. For i = 1 To 5 ListView1.ColumnHeaders.Add Text:="Col " & i, Width:=sngWidth Next i ' Create twenty ListItem objects. For each ListItem, create four ' ListSubItem objects. Set the ForeColor for each object to red. For i = 1 To 20 Set li = ListView1.ListItems.Add(Text:="Item " & i) For j = 1 To 4 Set si = li.ListSubItems.Add(Text:="Subitem " & j) si.ForeColor = vbRed Next j Next i End Sub
I basically use the .SubItems proerty for this. So whats the difference between the .ListSubItems and .SubItems?