I have a set of TextBox that are called for example: TB_Nombre, TB_Calle, TB_Telefono and TB_Email, which will be fed from a BD and which fields match the name, so make the following code:
List<string> d = new List<string> { "Nombre", "Calle", "Telefono", "Email"};
DataRow registro = datos.Tables[0].Rows[0];
foreach (string i in d){
TextBox tb = this.Controls.Find("TB_" + i, true).FirstOrDefault() as TextBox;
tb.Text = registro[i].ToString();
}
certainly does the work, but is it appropriate to work the controls from Controls.Find
?