NewImageListPicture

Description

Adds a picture to an imagelist, but only if the specified key does not already exist.

Returns the location (index) at which the picture (or a previous picture with the specified key) was stored. You need this index value when you want to refer to a picture in an imagelist, for instance when adding a listitem to a listview.

Syntax

[Index =] oFrm.NewImageListPicture ( ImageList, Picture, Key )

Parameters

Part

Description

Index =

(Return value) The location (index) at which the picture was stored in the imagelist (or the location of a previous picture with the specified Key).

The index property is set by default to the order of the creation of pictures in the imagelist. The index for the first object will always be one (1).

Please note that an index can change when the pictures in the imagelist are reordered, such as when you set the Sorted property to True

oFrm

A reference to a form object (see the NewForm method)

ImageList

Specifies the imagelist object to which the picture should be added

Picture

Specifies the picture to be added to the imagelist

Key

A unique string that identifies the picture

Example

See the GetAssociatedIcon page for an example