private void FillTables() { using (var context = new MyJukeboxEntities()) { Label label; TextBox textBox; var settings = DataGetSet.GetParameters(); foreach (var setting in settings) { label = new Label(); label.Name = $"label{setting.ID}"; label.ForeColor = System.Drawing.Color.White; label.AutoSize = true; label.Anchor = AnchorStyles.Left; label.Text = $"{setting.Name}"; tableLayoutPanel.Controls.Add(label); textBox = new AutoSizeTextBox(); textBox.Name = $"{setting.Name}"; textBox.AutoSize = true; textBox.Text = $"{(setting.Value.Length == 0 ? " " : setting.Value)}"; if (setting.Editable == false) { textBox.Enabled = false; } tableLayoutPanel.Controls.Add(textBox); } } }