protected bool CreateInstanceOnType_Internal(object instance, string property, string TypeName, params object[] args)
{
SetError();
object newInstance = null;
Type type = null;
try
{
type = GetTypeFromName(TypeName);
if (type == null)
{
SetError("Type not loaded. Please load call LoadAssembly first.");
return false;
}
newInstance = type.Assembly.CreateInstance(TypeName, false, BindingFlags.Default, null, args, null, null);
}
catch (Exception ex)
{
LastException = ex;
SetError(ex.Message);
return false;
}
try
{
ReflectionUtils.SetPropertyExCom(instance, property, newInstance);
}
catch (Exception ex)
{
LastException = ex;
ErrorMessage = ex.Message;
return false;
}
return true;
}