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

How are you declaring imageList?

Is it:

Dim imageList as New List(Of Image)

How are you storing these images?

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

ImageList1.Images.RemoveAt(1)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.