Dispose()
only cleans up unmanaged resources (although Paul Williams noted in the comments that it is usually more complex than this!) so it may or may not do anything useful in your case.
Try removing the controls with the RemoveAt(i)
method, not Dispose()
:
for(int i = panel.Controls.Count-1; i >= 0; i--)
{
panel.Controls.RemoveAt(i);
}
Dan Herbert
2009-09-29 15:32:17