How to get/set property of control (in this case Button)?
I tried on this way:
Type t = Type.GetType("System.Windows.Forms.Button");
PropertyInfo prop = t.GetType().GetProperty("Enabled");
if (null != prop && prop.CanWrite && prop.Name.Equals("button1"))
{
prop.SetValue(t, "False", null);
}
but t is null. What is wrong here?
Aucun commentaire:
Enregistrer un commentaire