怎么透过string形式的名称来访问某个控件?
例如:
string theName="textBox1";
theName.Text=.........; // 目的是想访问 textBox1
[解决办法]
string theName = "textBox1";
foreach (var item in this.Controls.Find(theName, false))
{
if (item is TextBox)
{
TextBox tb = item as TextBox;
MessageBox.Show(tb.Text);
break;
}
}