private void Button6_click (object sender, EventArgs e)
{
This.listBox1.Items.Clear ();
Fieldinfo[] Fieldinfos = this. GetType (). GetFields (BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
foreach (FieldInfo thefieldinfo in Fieldinfos)
{
PropertyInfo thepropertyinfo = TheFieldInfo.FieldType.GetProperty ("Text");
if (Thepropertyinfo = = null) continue;
string ctrlname = Thefieldinfo.name;
String className = TheFieldInfo.FieldType.ToString ();
String oldValue = Thepropertyinfo.getvalue (Thefieldinfo.getvalue (this), null). ToString ();
String newvalue = "Kunshan";
String Line1 = String. Format ("class name ={0} \ t control name ={1}", ClassName, Ctrlname);
String Line2 = String. Format ("old value ={0} \ t new value ={1}", OldValue, NewValue);
This.listBox1.Items.Add ("");
THIS.LISTBOX1.ITEMS.ADD (LINE1);
THIS.LISTBOX1.ITEMS.ADD (Line2);
Thepropertyinfo.setvalue (Thefieldinfo.getvalue (this), "Jade", null);
}
}
Control name gets and sets