秀啊!
现在知道一个字符串“label1”
想根据这个“label1”操作窗体内 label1控件的TEXT值
答案:
string name = "label1";
object o = this.GetType().GetField(name, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase).GetValue(this);
((Label)o).Text = "hello world!";
转载:https://blog.csdn.net/pencher_liu/article/details/82462356