Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6746703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:21:15+00:00 2026-05-26T12:21:15+00:00

I am using a ListView to load and display thumbnails for image files. The

  • 0

I am using a ListView to load and display thumbnails for image files. The “Name” or key that I’m using for each ListViewItem is the fully-qualified file name.

I have also created an ImageList which loads thumbnails of those files using the same key. I’ve assigned this ImageList as the “SmallImageList” property of the ListView.

When I add and remove files, I add and remove them by key from both the ListView.Items and the ImageList.Images collections.

All of this works fine when loading many images. However, when I try deleting a given key, the ListView control no longer displays the thumbnails properly.

Before and after deleting an item:

Before
After

When I analyze both collection arrays in memory during debugging, the keys line up perfectly.

Code used:

// Add the images from an array of paths
foreach (string xFile in files)
{
    thumbnails_imageList.Images.Add(xFile, images[xFile]);
    files_lst.Items.Add(xFile, Path.GetFileNameWithoutExtension(xFile), xFile);
}

// Delete the selected key(s)
foreach (ListViewItem xItem in files_lst.SelectedItems)
{
    files_lst.Items.Remove(xItem);
    thumbnails_imageList.Images.RemoveByKey(xItem.Name);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:21:16+00:00Added an answer on May 26, 2026 at 12:21 pm

    what happens is clear, if you have a ListViewItem bound to image index 5 and you delete the image in position 4, the 5 shifts down to 4 and the item keeps a reference to the 5 so does not show any image.

    I think you should not remove the images from the ImageList when you remove the selected ListView items.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a ListView control to display Pictures along with description and caption.
I am using a listview, and trying to populate using a file. I need
i'm creating a lazy load of image in ListView. i was followed the tutorial
I have a PlaceHolder control inside of a ListView that I am using to
I am using a Listview in a usercontrol that I databind to a list
I am using a ListView to display some images and captions associated with those
I m using hashmap for a listview. map = new HashMap<String, Object>(); map.put(name, R.string.information);
I'm using a list view control that is attached to an image list to
I was using the code from the doInBackground section to load a custom listview
I am using ListView/DataPager. For performance reasons I page my results at database, using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.