Is there a way to create an array of controls. In particular I’d like to create a collection/array of label controls that can be referenced via an index number.
Thanks,
Ken
Is there a way to create an array of controls. In particular I’d like to create a collection/array of label controls that can be referenced via an index number.
Thanks,
Ken
Hello,
Could you expand your use case a bit further? It can surely be done in multiple ways.
For instance, if it is just a handful of Labels, you can add them to a form, which makes it easier to format them individually as you like.
Then, inside function Main(), just detach them from the form and add to your array. It will be executed when your app is initialized.
When you want to access and show them, you can do so by the array index and attach it to the control you want to be its parent.
Detach: Node: removeChild() method - Web APIs | MDN
Attach:
Hope this helps
Ricardo Carraretto
Here’s an old blog post showing how to create an array of buttons. It would work for labels, too.