I have dynamically generated controls on the panels of windows form and i have also generated a button for removing the controls, all in rows.
int c = 0;
pri
If you have a Panel o other container with more dinamicaly components for remove all or more than one you can proceed in this way.
In first step you load a component in array or list.
List lst = new List();
foreach (Object obj in this.PanelImplementationTeam.Controls)
{
//DO NOT REMOVE COMPONENT IN THIS LOOP BECAUSE
//YOU DECREASE THE .Controls ARRAY AND YOU WILL HAVE AN ERROR
if (obj is PersonalUserControl)
{
lst.Add((PersonalUserControl)obj);
}
}
foreach(PersonalUserControl uc in lst)
{
uc.Dispose();
}