I have a Panel control. And inside the panel users can add combobox\'s, textbox\'s labels etc and drag them around and stuff, and there\'s a Delete button on my form where if th
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);
}