Bilal,
No, you can't really do that, but what you could do is iterate through the Form's Controls collection, test which ones are TextBoxes, then assign the text to that control. In C# it would be something like this:
int ArrayIndex = 0;
for (int i=0; i < this.Controls.Count; i++)
{
if (this.Controls[i] is TextBox)
{
((TextBox)this.Controls[i]).Text = TheArray[ArrayIndex].ToString();
ArrayIndex++;
}
}
You can do the conversion to VB here:
http://www.carlosag.net/Tools/CodeTranslator/~~Bonnie
>I am a beginner using Visual Basic.Net and I find myself needing to populate a lot of label controls with data from an array. Is it possible to refere to the label names with a variable? For example - if I have labels named label1 and label2, can I assign their text value at runtime with some kind of variable to indicate the number portion of the name. Something like labeli.text = "something", then increment i by 1 and then repeat the statement - only this time labeli now becomes label2. This way I can assign all the text values of each label with a loop instead of coding them all out individually.
>
>Thanks for the help.
>
>Bilal.