I am trying to use a loop to edit the data of multiple text boxes, but I cannot figure out how to convert a string of which the contents are the name of my box to access the text element of each box.
private void reset_Click(object sender, EventArgs e)
{
string cell;
for(int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
cell = "c" + Convert.ToChar(i) + Convert.ToChar(j);
cell.text = "";
}
}
My text boxes are named "c00, c01, .... c87, c88" which is what the contents of my "cell" variable would be during each iteration, however the code above does not work because it is trying to access the "text" element of a string which obviously does not make sense.
Obviously I could clear the contents of each box individually but since I will have multiple events which will change the contents of the text boxes it would be ideal to be able to implement a loop to do so as opposed to having 81 lines for each event.