Теперь я хочу включить или отключить этот столбец текстовых полей наилучшим образом, возможно, не используя массив или циклы. Как мне это сделать?
// create a column of textboxes dynamically
private void CreateControl(int ControlId)
{
CheckBox control1 = new CheckBox();
control1.Click += new EventHandler(chk_CheckedChanged);
Point point = GetPoint(ControlId);
control1.Location = point;
this.Controls.Add(control1);
}
// a check box to enable or disable that column of textboxes
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
Column column = new Column();
CheckBox chk = (CheckBox) sender;
if (chk.Checked)
{
column.EnterName.Enabled = true;
// I want to enable or disable the entire column of textboxes
}
}
Public Class Column
{
public TextBox EnterName {get;set;}
}