How handle many labels controls in an indexed way

I have been plasced many label in my window's form, those are place at design time, so are named as label1, label2, ...

How can i handle them as was an array of labels; but I don't want to assign to an array of labels to handle in that way.

Is there any property or method where can get the label's object base in text info.
sorry, but I can explain it clearly, let me put as an example:

label MyLabel = SOME_METHOD("label" + i.ToString()); where i = 1...20

so, I can work over a label choose by "i".


thanks in advance for your help,
Edward


Answer this question

How handle many labels controls in an indexed way

  • Computer Science Student

    not sure I still follow. You can get a control back from the Controls collection in your form....

    Label theLabel = this.Controls[label];

    is this what you maybe after If you can try to explain it a bit better, it would be great :-)



  • acoliveira

    that is exactly what in need, thank you very much.



  • How handle many labels controls in an indexed way