C# 如何启用或禁用一列文本框?
现在我想以最好的方式启用或禁用该列文本框,可能不使用数组或循环。我该怎么做C# 如何启用或禁用一列文本框?,c#,C#,现在我想以最好的方式启用或禁用该列文本框,可能不使用数组或循环。我该怎么做 // create a column of textboxes dynamically private void CreateControl(int ControlId) { CheckBox control1 = new CheckBox(); control1.Click += new EventHandler(chk_CheckedChanged);
// 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;}
}
- 添加一个GroupBox或一个面板(如果你没有创造一个什么都没有的幻觉,没有边框)来容纳文本框列
- 根据需要切换Groupbox的Enabled属性李>
我想这样行。y您不想使用数组或循环吗?