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!!!
naura paxPosted Oct 22, 2009, 3:59 AM
Master BillaPosted Oct 22, 2009, 4:22 AM
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