WinForms Controls.Clear() cause memory leaks?
I have created a windows application, where on the form i have one pannel, in which i have lots of control, when i tried to call panel.Controls.clear(), to remove the existing controls , memory leaks and when i try to add the controls again, i got an exception.
Please help!!!
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

naura paxRank #2,843 · 502 reputationPosted Oct 21, 2009, 11:59 PM EDT
Master BillaRank #2,229 · 630 reputationPosted Oct 22, 2009, 12:22 AM EDT
WinForms Controls.Clear(), its just remove the object from the control collection array, not from the momery.
if you need call forcefully dispose the object from the memory.
http://c-sharpexpertizer.blogspot.com/2008/09/finalize-vs-dispose-in-c.html
thank you