Add (ListItems)

This method adds a ListItem object to a ListItems collection in a ListView control.

Syntax

listitems.Add([index], [key], text, [icon], [smallicon])

Parameters

listitems
Required. Name of a ListItems collection.
index
Optional. Integer that specifies the position to insert the ListItem. If you do not specify an index, Add appends the ListItem to the end of the ListItems collection.
key
Optional. Unique string expression that can be used to access a member of the collection.
text
String associated with the ListItem control.
icon
Optional. Integer that sets the icon to be displayed from an ImageList control when the ListView control’s View property is set to lvwIcon.
smallicon
Optional. Integer that sets the icon to be displayed from an ImageList control when the ListView control’s View property is set to lvwSmallIcon.

Return Value

Reference to the new ListItem object.

Remarks

Use the Key property to reference a member of the ListItems collection if you expect the value of an object's Index property to change.