I\'m building a flow layout panel whose each control represents for a room. I want to reload all room by removing all controls in the panel and adding new controls.
I us
Note: this is a working solution based on the previous comment, so credits to that person :)
This worked for me:
List listControls = new List();
foreach (Control control in flowLayoutPanel1.Controls)
{
listControls.Add(control);
}
foreach (Control control in listControls)
{
flowLayoutPanel1.Controls.Remove(control);
control.Dispose();
}
There is probably a better/cleaner way of doing it, but it works.