I am fairly new to C# so forgive me if this is a simple question but I cannot seem to find anything on this subject (I am proabably not searching for the correct thing)
How would you go about setting form control properties such as a succession of many label's text properties dynamically after an event trigger such as a button click?
For an example of a snippit of code I am toying with...
/* * The array is already filled with 7 random numbers from * a method called generateRandom() * * This code works just fine. * I am trying to figure out how I can do this * without having to hard code the labels text output */ int theArray; rng.generateRandom(out theArray); labelNum0.Text = theArray.ToString(); labelNum1.Text = theArray.ToString(); labelNum2.Text = theArray.ToString(); labelNum3.Text = theArray.ToString(); labelNum4.Text = theArray.ToString(); labelNum5.Text = theArray.ToString(); labelNum6.Text = theArray.ToString();
Instead of having to hard code the label's output, how would I go about doing it automatically?
Thank you in advance for any insight you can provide!