If I have this code:
Label label1 = new Label();
Form1.Controls.Add(label1);
Label label2 = label1;
What’s really on From1? Is it label1? Or is it the object label1 points to?
In other words if I then have this:
Form1.Controls.Remove(label1);
have I effectively removed the label? Or is label2 keeping it on the form?
I guess I’m wondering, is it the pointer that’s on the Form, or is it the object the pointer points to?
Controls.Add() adds a reference to whatever Control you pass to it. label2 = label1 just creates another reference to label1. Controls.Remove() doesn’t delete the object, it just removes it from its list of controls.
So, in your example, after you call Controls.Remove():