I have a VB.Net WinForm Program. I dynamically create panels with controls. Each panel has: 2 Labels 1 DataGridView 1 Button Everything works fine the first time I create the panels. Everything gets created, and everything is functional.
If I have to re-create the form, I get rid of the existing panels (and their controls) with this code:
For P = 0 To Panels.Count - 1
For Each PControl In Panels(P).controls
Panels(P).controls.remove(PControl)
Next
Me.Controls.Remove(Panels(P))
Next
Panels.Clear()
DataGrids.Clear()
lblCounts.Clear()
Where: Panels, DataGrids, & lblCounts are ArrayLists holding controls
When I re-create the panels, I get the panels and all of their controls except Buttons When I step through the debugger, I see the buttons being removed, and I see them being created, but they don't appear in the panel Any ideas?