错误信息:
未处理的“System.Reflection.TargetException”类型的异常出现在 system.dll 中。
其他信息: 对象与目标类型不匹配。代码如下:
public object SetValueControlPropertyTT(object   ClassInstance,string ControlName,string PropertyName)
{
object ResultDD =null;
System.Type myType = ClassInstance.GetType();
FieldInfo myFieldInfo = myType.GetField(ControlName,BindingFlags.NonPublic | BindingFlags.Instance|BindingFlags.Public|BindingFlags.InvokeMethod|BindingFlags.IgnoreCase);
  if(myFieldInfo!=null)//"_"+
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(myType);
PropertyDescriptor myProperty = properties.Find(PropertyName,false);
if(myProperty!=null)
  {
object ctr;
ctr = myFieldInfo.GetValue(ClassInstance);
try
{
myProperty.SetValue(ctr,false);
ResultDD = ctr;

}
catch(SqlException ex)
{}
   }
}
return ResultDD; }private void bt_Click(object sender, System.EventArgs e)
{
string btnName = txtIn.Text.ToString();
this.SetValueControlPropertyTT(this, "tbaBtSaveData" , "Enabled");
}