ListSubItem(s)

Description

The ListSubItems collection contains one or more ListSubItem objects.

The ListSubItems collection replaces the SubItems property (array of strings). The SubItems array is still available in the ListView control, but it's recommended that new applications use the ListSubItems collection because of the increased flexibility.

ListSubItems Collection Properties and Methods

Property

Description

Count

(read-only) The total number of ListSubItems in the collection

Item (Index)

Returns a specific member of the collection (either by position or by key).

Because Item is the default property, the following lines are equivalent :
Print MyCollection(1)
Print MyCollection.Item(1)

Method

Description

Add

Parameters: [Index], [Key], [Text], [ReportIcon], [ToolTipText]

Adds a ListSubItem to a ListSubItems collection

Index

(optional) An integer specifying the position where you want to insert the ListSubItem. If not specified, the ListSubItem is added to the end of the ListSubItems collection.

Key

(optional) A unique string that identifies the ListSubItem, Use this value to retrieve a specific ListSubItem. An error occurs if the key is not unique.

Text

(optional) The string displayed by the ListView in Report view

ReportIcon

(optional) The Index or Key property value specifying a ListImage object in the associated ImageList control

ToolTipText

(optional). The string displayed when the mouse pointer hovers over the ListSubItem

Clear

Removes all ListSubItems in the collection

Remove

Parameters: Index

Removes a specific ListSubItem. Index is an integer or string that uniquely identifies the ListSubItem. Use an integer to specify the value of the Index property; use a string to specify the value of the Key property.

Individual ListSubItem Properties and Methods

Property

Description

BackColor

Background color (use the RGB function to assign a color value)

Bold

(boolean) Determines if the object text is bold. The default is False

ForeColor

Foreground color (use the RGB function to assign a color value)

Index

(read-only) A number that uniquely identifies a ListSubItem in the collection. The index is set by default to the order of the creation of objects in a collection. The index for the first object in a collection will always be 1

ReportIcon

Returns or sets a value that specifies an image for the ListSubItem (only when the ListView is in Report mode). The value is the index (or unique key) of a ListImage object in an ImageList control that was assigned to the ListView's SmallIcons property

Tag

Can be used to store any extra data needed for your program

Text

Returns or sets the text contained in the ListSubItem

ToolTipText

Explanatory text that appears in a small rectangle below the object when you pause the mouse pointer (hover) over it for about one second