【发布时间】:2015-02-14 22:36:58
【问题描述】:
添加按钮:
Button button = new Button();
this.Controls.Add(button);
button.Name = "btn" + id;
button.Text = "AAAA";
结果是按钮名称为btn55,但是,如何更改按钮名称btn55上的文本?
类似
private void btnaktual_Click(object sender, EventArgs e)
{
btn55.Text = "BBB";
}
给我错误:
错误 1 当前上下文中不存在名称“btn55”
【问题讨论】:
-
事件中应该是
button.Text = "BBB"