[Gambas-user] how to write text in indexed list of labels
bagonergi at gmail.com
Sun Sep 6 23:11:12 CEST 2020
Il giorno dom 6 set 2020 alle ore 20:00 Gianluigi <bagonergi at gmail.com> ha
> Il giorno dom 6 set 2020 alle ore 19:45 Benoît Minisini <g4mba5 at gmail.com>
> ha scritto:
>> Le 06/09/2020 à 17:58, pinglix via User a écrit :
>> > Hi,
>> > 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.
>> 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.
> Yes, I apologize, mine is not good Gambas code, don't use it :-(
just one question, is this code acceptable or will I be burned at the stake
Public Sub Button1_Click()
Dim obj As Object = Me["Label" & $iIndex]
obj.text = "Pippo"
P.S. Naturally accompanied by the advice to study Last, Tag, Action and
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User