LvwListSubItem class
One subitem of an item of a ListView: the text of one column of the report view, with its key, its icon, its color and its tool tip. A program gets one from the item’s LvwListSubItems collection and its Add method.
Dim Item As LvwListItem, Size As LvwListSubItem
With ListView1
.View = LvwViewReport
.ColumnHeaders.Add , , "Name"
.ColumnHeaders.Add , , "Size"
Set Item = .ListItems.Add(, , "readme")
Set Size = Item.ListSubItems.Add(, "size", "2 KB")
Size.Bold = True
Size.ForeColor = vbRed
Debug.Print Size.Index; Size.Key; " "; Size.Text; " "; Item.SubItems(1)
End With
' Output:
' 1 size 2 KB 2 KB
A program cannot make an LvwListSubItem object with New. The object stands for a number of the item’s subitems: after a subitem in front of it is added or removed, it works on the subitem that now has that number.
Properties
Bold
Whether the subitem’s text is drawn in bold. Boolean. Default: False.
ForeColor
The color of the subitem’s text. OLE_COLOR. A new subitem has the ForeColor of the control, and follows it until the program gives it a color of its own; ResetForeColors takes that color away again.
Height, Left, Top, Width
The place and the size of the subitem’s cell in the report view, in the scale units of the control’s container. Single, read-only.
An assignment raises run-time error 383.
Index
The number of the subitem, from 1. Long, read-only.
Key
The subitem’s key, given by Add. String, read-only. Empty for a subitem without a key.
ReportIcon
The number or the key of the icon drawn in front of the subitem’s text, in the image list of SmallIcons. Variant. Empty when the subitem has none. An assignment takes a number or a key; a key that the image list does not have raises run-time error 35601.
ReportIconIndex
The number of the subitem’s icon in the image list, also when ReportIcon names it by its key. Long, read-only. 0 when the subitem has none.
Tag
A value of the program’s own, which the control does not use. Variant: it holds a value of any type, an object included, which is assigned with Set. A new subitem has an empty string.
Text
The subitem’s text. String. It is the default member. It returns the whole text, however long; see the warning under the item’s SubItems.
ToolTipText
The text shown in a tip while the pointer rests on the subitem in the report view and ShowInfoTips is True. String. Default: empty.
See Also
- LvwListSubItems class – the subitems of an item
- LvwListItem class – the item