I want to look up a label at runtime, is this the correct way to do it?
Control[] control;
Label label;
control = this.Controls.Find(labelToChange, false);
label = (Label)control[0];
I couldn’t find a method that returns a single control, so I had to store it a collection and then retrieve the first one. It will always find a single item.
This is the correct method to use.
The MSDN documentation doesn’t indicate why it returns a collection, but if you have the a control that encapsulates several sub controls and instantiate that several times you will end up with a collection of labels.
So: