[Gambas-user] how to write text in indexed list of labels
g4mba5 at gmail.com
Sun Sep 6 19:44:18 CEST 2020
Le 06/09/2020 à 17:58, pinglix via User a écrit :
> I have 200 Label components on a form with name Label1, Label2 ....
> Label200 and I need to change the Text property of one of them through
> an integer index.
> What is the best way to do it ?
> I cannot find a Find() method by name that returns a reference to the
> correct object.
> I can set them to the same Group but then what can I do with it ?
Window (and so Form) objects can be used as a collection of its children
controls indexed by name.
I.e. : MyForm["Label" & Index] will return the Label<Index> control.
But you should better create such many labels dynamically and store the
references in your own array of Labels.
More information about the User