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
According to MSDN, you can clear all controls from a ControlCollection
(such as a FlowLayoutPanel
) by calling the Clear() method. For example:
flowLayoutPanel1.Controls.Clear();
Be aware: just because the items are removed from the collections does not mean the handlers are gone and must be disposed of properly less you face memory leaks.