Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control array
Message
From
27/04/1998 15:01:57
 
 
To
27/04/1998 14:57:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00095209
Message ID:
00095217
Views:
21
>>>hi,
>>>
>>>How can i create controls with the same name?
>>>In VB this is done automatically, just copy the control
>>>and then paste it on the same form, however this is not
>>>allowed in VFP and i can't find a method to do the similar
>>>thing.
>>>If this can be found in the Help, please tell me coz i've
>>>already read it many times but still cant find it.
>>>
>>
>>Actually you have ready to use Form.Controls array
>
>Yes I know this array, but I'm not only going to refer to them, let say
>
> ...
> For i = 1 to 5
> Form1.CommandButton1(i).Caption = "This is button " + Alltrim(Str(i))
> EndFor
>
> For i = 1 to 3
> Form1.Label1(i).Caption = "This is label " + Alltrim(Str(i))
> EndFor
> ...
>
>That's what I would like to see. Is it possible to do so in VFP ?
>
>Thanks.
>
>
>Kenneth

Everything is possible, but any non-standard approach will take time a little bit, e.g. now you should create custom collection Form.Mycontrols and fill it e.g. in Form.Init event:
Dimension This.Mycontrols(3)
This.Mycontrols[1]=this.label1
This.Mycontrols[2]=this.label2
This.Mycontrols[3]=this.label3
Now it's up to you to use this collection members to references your labels in code. Before you will start to do this, look at SetAll method. It might be enough for your purposes.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform