G
Guest
Hey all
I'm trying to late bind a VB6 object in Component Services using c#. I've been able to do tons of late binding, but now that I have a com+ object that doesn't have a method exposed directly, I'm having tons of trouble. (lots of research, lots of newsgroups, but no success!
I have an existing COM+ object "Company.Person" which has several interfaces. To load my object, I have to invoke a method that is "Imported" to "Person", the main interface (via the imported interface, IUser).
When late binding, this interface doesn't appear to be accessible. How do I invoke the "Load" method on IUser to populate my Company.Person object
Attempted Code
Type myUserType= Type.GetTypeFromProgID("Company.Person")
object objMyUser = Activator.CreateInstance(myUserType)
// parameters needed to load objMyUse
object[] parameter = new object[2]
parameter[0]=m_strDBConn
parameter[1]="GeorgePBurdell";
//I've tried this with 8 gazillion different BindingFlags combinations...
// I haven't found any great docs on the differences between the flag
myUserType.InvokeMember("Load"
BindingFlags.Public | BindingFlags.Static
BindingFlags.NonPublic |BindingFlags.Instance | BindingFlags.DeclaredOnly
BindingFlags.InvokeMethod, null, objMyUser, parameter)
When I try to InvokeMember on the "Load" command, I get the dreaded mscorlib.dll error, with the extremely helpful, "unknown name" description
Any code snippets would be great
Thanks
Jim
I'm trying to late bind a VB6 object in Component Services using c#. I've been able to do tons of late binding, but now that I have a com+ object that doesn't have a method exposed directly, I'm having tons of trouble. (lots of research, lots of newsgroups, but no success!
I have an existing COM+ object "Company.Person" which has several interfaces. To load my object, I have to invoke a method that is "Imported" to "Person", the main interface (via the imported interface, IUser).
When late binding, this interface doesn't appear to be accessible. How do I invoke the "Load" method on IUser to populate my Company.Person object
Attempted Code
Type myUserType= Type.GetTypeFromProgID("Company.Person")
object objMyUser = Activator.CreateInstance(myUserType)
// parameters needed to load objMyUse
object[] parameter = new object[2]
parameter[0]=m_strDBConn
parameter[1]="GeorgePBurdell";
//I've tried this with 8 gazillion different BindingFlags combinations...
// I haven't found any great docs on the differences between the flag
myUserType.InvokeMember("Load"
BindingFlags.Public | BindingFlags.Static
BindingFlags.NonPublic |BindingFlags.Instance | BindingFlags.DeclaredOnly
BindingFlags.InvokeMethod, null, objMyUser, parameter)
When I try to InvokeMember on the "Load" command, I get the dreaded mscorlib.dll error, with the extremely helpful, "unknown name" description
Any code snippets would be great
Thanks
Jim