locked
To clear memory of loaded images in a picturebox-c# RRS feed

  • Question

  • Hello experts,                                                                                                                                                Initially i will be loading images(say 20images) into a picture box from a specified folder through selection from combobox dropdown , they get loaded normally into picturebox. The problem i am facing is when i select the next folder to acquire the image for processing, the previously selected folders images are also displayed in the picturebox after its count only the next folders images are displayed, i am unable to clear the previously loaded images. To be specific, when i click on a folder from dropdown i want the particular folders image inside the picturebox i dont want the previously loaded images along with them. Am working in VS2013 with c#. Thanks in advance.
     
    • Moved by CoolDadTx Wednesday, September 14, 2016 2:12 PM Winforms related
    Wednesday, September 14, 2016 9:00 AM

Answers

  • A picturebox only shows a single image at a time so if you're getting multiple images then you are doing so by enumerating the files and combining them together. Since this is in your code and not part of what PB does we cannot really help you unless you post the code that demonstrates exactly how you are generating the image and putting it into the PB.

    Wednesday, September 14, 2016 2:12 PM

All replies

  • First, what is your display technology? WinForms, WPF, UWP, ASP.NET, other?

    Secondly, what is your code that goes through the pictures?
    Pictureboxes usually display only one image. So you have to have some code

    If your code is long, please make a short, ready to compile example that showcases your problem.
    In either case plese put code into code blocks (2nd option from the right).


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Wednesday, September 14, 2016 9:46 AM
  • A picturebox only shows a single image at a time so if you're getting multiple images then you are doing so by enumerating the files and combining them together. Since this is in your code and not part of what PB does we cannot really help you unless you post the code that demonstrates exactly how you are generating the image and putting it into the PB.

    Wednesday, September 14, 2016 2:12 PM