I’m trying the following code:
for (int i = 0; i < students.Length; i++)
{
"student" + i.ToString().Text = students[i];
}
I already have many labels which each one has name like:
student1
student2
student3
.
.
But I got this error:
Error 1 ‘string’ does not contain a definition for ‘Text’ and no extension method ‘Text’ accepting a first argument of type ‘string’ could be found (are you missing a using directive or an assembly reference?) F:\Homework\Homework\Form1.cs 161 46 Homework
Any help please??!
You can’t have dynamic variable names, in just about any language.
Looks like you are looking to have a collection or array of controls.
Something like: