How to get LinkLabel text from some List of strings with loop?

112 Views Asked by At

If I have for example linklabel1, linklabel2, linklabel3....linklabel10. And some list of string that count 10 item.

How do I pass each strings(first string it's going to be text in linklabel1, second string in linklabel2....) in than link label with loop?

1

There are 1 best solutions below

0
Arno On

Asuming it's windows forms use Control.ControlCollection.Find.

This allows you to find a GUI component by string name meaning you can use a for loop and add i+1 to "linklabel" find the LinkLabel using .Find and then alter the .Text value using the string on index i from your list