473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

InvokeMethod saying wrong number of parameters?

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.

Aug 28 '07 #1
1 1591

"JamesB" <ja***@somewhere.com.net.com.netwrote in message
news:46***********************@news.zen.co.uk...
>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.

Aug 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
0
by: Edward | last post by:
I have a wrapper function for executing a SQL Server Stored Procedure that returns no records: Public Function modRunStoredProc(vstrSPName As String, ParamArray vvarParams() As Variant) As...
2
by: julien | last post by:
Hello, I have an assembly with a static variable: private static readonly ILog log4net = LogManager.GetLogger(typeof(Core)); In one of the methods, I use this variable: private void myMethod()...
2
by: Julio Allegue | last post by:
I am getting the wrong Count(*) on vb.net using the ExecuteScalar . It returns all the rows. It doesn't seem to look at the WHERE clause. At the same time, I am getting the correct count on "SQL...
6
by: Sameh Ahmed | last post by:
Hello there Anybody used Managementobject.invoke method? if yes how do u send method parameters? Thanks in advance Regards Sameh
3
by: brianbasquille | last post by:
Hello all, Strange little problem here... am just trying to insert some basic information into an Access Database using OleDB. I'm getting a "Syntax error in Insert Into statement" when it...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
1
by: Sandro Bosio | last post by:
Hello everybody, my first message on this forum. I tried to solve my issue by reading other similar posts, but I didn't succeed. And forgive me if this mail is so long. I'm trying to achieve the...
16
by: arne | last post by:
Hi all, imagine I call a function, but omit one of the parameters, like: foo.c: void foo( int a, int b ) { /* do something with a and b */ return; }
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.