[Gambas-user] how to write text in indexed list of labels

Gianluigi bagonergi at gmail.com
Sun Sep 6 18:40:05 CEST 2020

Il giorno dom 6 set 2020 alle ore 18:22 Christof Thalhofer <
chrisml at deganius.de> ha scritto:

> Am 06.09.20 um 17:58 schrieb pinglix via User:
> > 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 ?
> You can search for the program 'findfocus' in the software farm which
> iterates through all controls in a form to find the one which has the
> focus.
> The code in it does what you want if you adapt it to your task.

A simple thing?

Public Sub Button1_Click()

  Dim obj As Object

  For Each obj In FMain.Controls
    If obj.Name = "Label123" Then obj.text = "Pippo"


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20200906/86904d9a/attachment.htm>

More information about the User mailing list