InvokeMethod saying wrong number of parameters?

  • Thread starter Thread starter JamesB
  • Start date Start date
J

JamesB

I am trying to access a method in another VB6 application from my C# app. If
I add a reference to the relevant DLL it all works, and one bit where I need
to set a DB connection works by doing:

MyObj.setSolConnection(ref ADOConn)

Because clients may have different versions of our app though, I need to
adjust to using late binding. Originally I was getting unknown name type
exceptions, but if I InvokeMember on SolConnection instead of
setDBConnection it cures that one... however I get a new problem. First, I
cannot pass the ADOConn with "ref", however on it's own I get an error
saying the number of parameters is incorrect. According the object browser,
the item is defined as:

void set_SolConnection(ref ADODB.Connection __p1)
Member of OPS._Case


Any ideas? Not sure what the __p1 bit on the end signifies, other methods
don't seem to have this.
 
JamesB said:
I am trying to access a method in another VB6 application from my C# app.
If I add a reference to the relevant DLL it all works, and one bit where I
need to set a DB connection works by doing:

MyObj.setSolConnection(ref ADOConn)

Because clients may have different versions of our app though, I need to
adjust to using late binding. Originally I was getting unknown name type
exceptions, but if I InvokeMember on SolConnection instead of
setDBConnection it cures that one... however I get a new problem. First, I
cannot pass the ADOConn with "ref", however on it's own I get an error
saying the number of parameters is incorrect. According the object
browser, the item is defined as:

void set_SolConnection(ref ADODB.Connection __p1)
Member of OPS._Case


Any ideas? Not sure what the __p1 bit on the end signifies, other methods
don't seem to have this.


Just to answer my own question...

I needed to use the "PutRefDispProperty" bindingflags, and it seems to work
(at least in a quick test app I hacked up)

James.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top