现在我想以最佳方式启用或禁用该列文本框,可能不使用数组或循环。我该怎么做?
// 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;}
}
答案 0 :(得分:1)
我认为这有用。