After deleted the image inside the imageList ,
do the imagelist auto arrange the image following by the number ?

Edited by on93

5 Years
Discussion Span
Last Post by tinstaafl

Yes the indexes of the images will change. If you want the indexes to remain the same, you could make a blank image and just replace instead of remove.

Even better is use the tag property to identify your images. Unless you have thousands of images, it wouldn't take a noticeable amount of time to search for a particular tag. This way your code can inherently handle any changes to your collection of images.


oh i see ...
so is this the code for remove image from the imageList


Yes removeat will work.

In addendum to my previous post, I forgot that imagelist implements a keys collection. If you setkeyname of the images when you add them, you can use such methods as removebykeyname, containskey, indexofkey, etc. This would be an even better way of not having to worry about changing indexes.

Edited by tinstaafl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.