I have a TableLayoutPanel
with two columns. I want to dynamically remove all controls from the second one. Is there a simple way? I really don't want tedious looping and things like that.
Edit: By "looping" I mean actually writing for-loops. LINQ solutions that loop behind the scenes are perfectly fine.
It depends strongly on what you mean by: "clear a column". I chose to set the visibility to
false
for this example.This looks really like a horrible hack:
but it does the job
EDIT:
here is the line that actually removes them:
inspired by @LarsTech: you can also call dispose and clear the list afterwards