I have created a for loop, and I wanted to add random text, loaded in from an array, to a different label each time the loop runs through. I have all the labels added to my form, called lbl1, lbl2, lbl3 etc.
Random r = new Random();
for (int i = 1; i <= 4; i++)
{
int randomtext = r.Next(0, mytext.GetLength(0)); //choosing random element of array to be added to label
//this is where I want to add the text to a random label
}
How can I add the text to a random label each time? Would I need to create an array or list of some kind? I was hoping there would be some way of just adding i as the suffix of the variable name each time. Sorry if this is obvious, I am new to C#.
Thanks!