Really Basic control set question

After creating a set of controls in code, how can I delete them, in code?

You need to keep a reference to each new member.

When you do for instance

P as new pushbutton1

If you dim P as Pushbutton the reference goes away as soon as the method/event is over.

If P is a property of the window, you can then do


If you have several controls, you can use P() and do

P.Append(new Pushbutton)

Then you have all your references in the P() array.