ListView.addItem

Overview | Methods | This Package | All Packages

ListView.addItem

Adds an item to the list view control and returns the new item.

Syntax

public ListItem addItem( ListItem listItem )

public ListItem addItem( String text )

public ListItem addItem( String text, int imageIndex )

public ListItem addItem( String text, int imageIndex, String[] subItems )

Parameters

listItem

A ListItem object containing the data for the item you want to add to the list view control.

text

The string to display for the list item.

imageIndex

The zero-based index of image within the ImageList object associated with this ListView control.

subItems

An array of strings that represent the subitems of the new item.

Return Value

Returns the ListItem object that represents the item you added to the list view control.

Remarks

If the sorting property of the list view control is set to SortOrder.ASCENDING or SortOrder.DESCENDING, the item is inserted into the list in sorted order. Otherwise, the item is inserted at the end of the list. To insert an item into the list view control at a specific position, use the insertItem method. To add a set of items to the list view control at one time, use the setItems method.

If you add a list item without specifying an image or subitems, the item is created without associated image or subitems.

See Also   removeItem