There is an array of mass numbers. It is necessary to drive it into the textbox components through a loop in order to reduce the size of the code. I do something like this
for (int i = 1; i <= 12; i++) { this.Controls["textbox" + i.ToString()].Text = mass[i-1]; } Crashes with the error "Object reference not specified in object instance." What is the problem? I tried to write inside the loop like this:
cls.frm1.Controls["textbox" + Convert.ToString(i)].Text = mass[i-1]; (here cls is a class, and frm1 is a form), but to no avail. The same mistake.