I have a user control called container in which I am adding other user controls at run time.
I want to remove all controls from container, I am doing container.Controls.Clear()
but my controls are still in memory, how can I make them null ?
Calling the Clear method does not remove control handles from memory. You must explicitly call the Dispose method to avoid memory leaks.
read more: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection.clear.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With