Try creating an array of textboxes:
Code:
private TextBox[,] controlArray = new TextBox[3, 3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
controlArray[i, j] = new TextBox();
}
}
//
// R1C1
//
controlArray[0, 0].Location = new System.Drawing.Point(7, 5);
controlArray[0, 0].Name = "R1C1";
controlArray[0, 0].TabIndex = 0;
controlArray[0, 0].Text = "";
// etc.
Then your assignment loop can look like this:
Code:
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
controlArray[i, j].Text = Int32.Parse(array[i, j]);
}
}
Bookmarks