I have inherited a very, very large c# program this displays images using Windows Controls.Add(catalogItem) to display a group of images related to the image that is clicked. What I cannot figure out is how to release the Handles/User Objects when the images are no longer displayed.
My program crashes, of course, when 10,000+ User objects are displayed. No, they are not displayed all at once, but a group of as many as 70 are displayed at one time.
What I would like to do is return/clean up those resources when the [Back] button is clicked.
I have tried using a Controls.Remove(catalogItem) call, and it does remove the picture from view, but it does not release the resources internally.
I am using Visual Studio Community 2017.