C # foreach interrupted

0

When I try to move the controls from a FlowLayouPanel to another flpPropriedades -> flpReserva through a foreach loop it leaves the middle and does not complete the transition.

foreach (Control control in flpPropriedade.Controls)   
{             
   flpReserva.Controls.Add(control);   
}

flpReserva.Refresh();
flpPropriedade.Refresh();

What could cause the loop to exit unexpectedly?

    
asked by anonymous 24.06.2016 / 11:00

1 answer

0

The solution found was to cycle do...While :

do
{
    flpReserva.Controls.Add(flpPropriedade.Controls[0]);
}
while (flpPropriedade.Controls.Count != 0);
    
24.06.2016 / 11:00