SuspendLayout not working with Controls.Clear

I have a TableLayoutPanel with a bunch of controls in it.

I want to wipe all the controls from the table and start over.

I do TLP.suspendlayout(); TLP.Controls.Clear(); and I can see in the form each individual control disappearing. Gross and slow!

So, I do iterate through TLP.Controls.Count and do TLP.Controls(iterator).SuspendLayout(); TLP.Controls.Clear() and I still see each control disappear one at a time.

What gives!



Answer this question

SuspendLayout not working with Controls.Clear

  • Ralph Deleja-Hotko

    This is still a significant problem.

    From what I've seen, I need to be using a TLP and not a DataGridView. The original code basically attempted to implement it's own version of a TLP before TLPs existed.

    So I have a TLP with over 200 controls in it, and I want to "reset" it. So as I said above, I loop over the controls, suspend them and then use Controls.Clear, and it appears that a layout is occuring per control.

    Is this a "feature" of Controls.Clear Or am i doing something wrong


  • SuspendLayout not working with Controls.Clear