IMHO the best way to design is by the way it's meant to be. In particular, rectangular/multidimensional arrays may be useful in this scenario:
public partial class Form1 : Form {
TextBox[,] textBoxes;
int[,] values;
public Form1() {
InitializeComponent();
textBoxes = new TextBox[4, 4];
values = new int[textBoxes.GetLength(0), textBoxes.GetLength(1)];
for(int r = 0; r < textBoxes.GetLength(0); r++) {
for(int c = 0; c < textBoxes.GetLength(1); c++) {
values[r, c] = int.Parse(textBoxes[r, c].Text);
}
}
}
}
(this.FindControl("textBox" + i) as TextBox).Textbut then you lose type safetyTextBoxcontrols, likeControl[] aTextBoxes = new Control[] { textBox1, textBox2, ..};, then looping through them with afor(int i=0; i < aTextBoxes.Length; i++) array[i] = Convert.ToInt32(aTextBoxes[i].Text);(complitly ommitingtry-catchblocks or checking the length of the array first)TextBox[]field in the form class. Also, there are things like jagged and rectangular/multidimensional arrays.