C# Disposing panels

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ania1984
    New Member
    • Jan 2008
    • 4

    C# Disposing panels

    Hello,

    I'm writing a program in c#, in which I create a flowlayoutpanel that contains a lot of panels. I have a button, and when the user clicks on it, I want to dispose the panels that I've created.
    This is the code:

    Code:
    foreach (Control c in myFlowLayoutPanel.Controls)
    {
        ((Panel)c).Dispose();
    }
    But looking at the Task Manager, I see that the memory usage doesn't decrease.
    I've also tried to call to the garbage collector
    Code:
    GC.Collect();
    but there is no difference.

    Does anybody know how can I achieve this?
    Thanks
Working...