N
nelsonivan
Hi,
i'm trying to reference some objects using reflection and Late Binding
accessing.
The Object API to his methods it's easy to understand, and it's as
"Object.Method" - aka. "Clientes.Existe"-
So, to reference this object, it was simplier to me resolving this
with reflection, and it was something like this:
Type motorPriBS = Type.GetTypeFromProgID("GcpBS601.GCPBS");
object clientes = motorPriBS.i .InvokeMember("Clientes",
System.Reflection.BindingFlags.GetProperty,
null,
hMotorPriBS,
null);
bool existeAl = (bool)motorPriBS.InvokeMember("Existe",
System.Reflection.BindingFlags.InvokeMethod,
null,
comercial,
new object[] {"0002"});
And it works well.
Now, the present situation changed the object API, and it's
referencing to "Object.Property.Method" -aka
"Comercial.Clientes.Existe"-
The code that i wrote is like this:
Type motorPriBS = Type.GetTypeFromProgID("GcpBS601.GCPBS");
//invoke object
object comercial= motorPriBS.InvokeMember("Comercial",
System.Reflection.BindingFlags.GetProperty,
null,
hMotorPriBS,
null);
//invoke propertie
object clientes = motorPriBS.InvokeMember("Clientes",
System.Reflection.BindingFlags.GetProperty,
null,
comercial,
null);
//invoke method
bool existeAl = (bool)motorPriBS.InvokeMember("Existe",
System.Reflection.BindingFlags.InvokeMethod,
null,
comercial,
new object[] {"0002"});
And, this don't work. When i invoke the method, it returns a error
"Unknown Name" and it seems that the object don't recognize the method
name "Existe". And i've sure it really exists.
Can anyone give a help in this matter?
i'm trying to reference some objects using reflection and Late Binding
accessing.
The Object API to his methods it's easy to understand, and it's as
"Object.Method" - aka. "Clientes.Existe"-
So, to reference this object, it was simplier to me resolving this
with reflection, and it was something like this:
Type motorPriBS = Type.GetTypeFromProgID("GcpBS601.GCPBS");
object clientes = motorPriBS.i .InvokeMember("Clientes",
System.Reflection.BindingFlags.GetProperty,
null,
hMotorPriBS,
null);
bool existeAl = (bool)motorPriBS.InvokeMember("Existe",
System.Reflection.BindingFlags.InvokeMethod,
null,
comercial,
new object[] {"0002"});
And it works well.
Now, the present situation changed the object API, and it's
referencing to "Object.Property.Method" -aka
"Comercial.Clientes.Existe"-
The code that i wrote is like this:
Type motorPriBS = Type.GetTypeFromProgID("GcpBS601.GCPBS");
//invoke object
object comercial= motorPriBS.InvokeMember("Comercial",
System.Reflection.BindingFlags.GetProperty,
null,
hMotorPriBS,
null);
//invoke propertie
object clientes = motorPriBS.InvokeMember("Clientes",
System.Reflection.BindingFlags.GetProperty,
null,
comercial,
null);
//invoke method
bool existeAl = (bool)motorPriBS.InvokeMember("Existe",
System.Reflection.BindingFlags.InvokeMethod,
null,
comercial,
new object[] {"0002"});
And, this don't work. When i invoke the method, it returns a error
"Unknown Name" and it seems that the object don't recognize the method
name "Existe". And i've sure it really exists.
Can anyone give a help in this matter?