>>>> switch (column) >>>> { >>>> case 0: >>>> textBoxColumn1.Text = stack[column, row].ToString(); >>>> textBoxColumn1.ForeColor = textboxforecolor; >>>> break; >>>> case 1: >>>> textBoxColumn2.Text = stack[column, row].ToString(); >>>> textBoxColumn2.ForeColor = textboxforecolor; >>>> break; >>>> case 2: >>>> textBoxColumn3.Text = stack[column, row].ToString(); >>>> textBoxColumn3.ForeColor = textboxforecolor; >>>> break; >>>> case 3: >>>> textBoxColumn4.Text = stack[column, row].ToString(); >>>> textBoxColumn4.ForeColor = textboxforecolor; >>>> >>>> break; >>>> case 4: >>>> textBoxColumn5.Text = stack[column, row].ToString(); >>>> textBoxColumn5.ForeColor = textboxforecolor; >>>> >>>> break; >>>> case 5: >>>> textBoxColumn6.Text = stack[column, row].ToString(); >>>> textBoxColumn6.ForeColor = textboxforecolor; >>>> break; >>>> case 6: >>>> textBoxColumn7.Text = stack[column, row].ToString(); >>>> textBoxColumn7.ForeColor = textboxforecolor; >>>> break; >>>> } >>>> >>>>>>>
string s = "textBoxColumn" + column.ToString(); >>>((TextBox)this.Controls.Find(s, true)[0]).ForeColor = textboxforecolor;>>
TextBox t = (TextBox)this.Controls.Find(s, true)[0]; >t.Text = stack[column,row].ToString(); >t.ForeColor = textboxforecolor;Do we need this code in a loop? E.g. column is a variable (0-6) ?