InvokeMethod saying wrong number of parameters? | Bytes (2024)

Home Posts Topics Members FAQ

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.setSolCon nection(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_SolConnecti on(ref ADODB.Connectio n __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

Subscribe Reply

1 InvokeMethod saying wrong number of parameters? | Bytes (1) 1602 InvokeMethod saying wrong number of parameters? | Bytes (2)

JamesB

"JamesB" <ja***@somewher e.com.net.com.n etwrote 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.setSolCon nection(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_SolConnecti on(ref ADODB.Connectio n __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 "PutRefDispProp erty" 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 2825

Help~! I don't know what's wrong with this program.

by: titan0111 |last post by:

#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;

C / C++

2238

3001 Arguments are of the wrong type

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 Variant On Error GoTo modRunOutputStoredProc_Err Dim cmd As Command Dim intIndex As Integer

Microsoft Access / VBA

2 2206

Invokemethod and static variables

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() { ... log4net.Debug("something to log"); ...

C# / C Sharp

2 2935

Wrong Count(*) on an objCommand.ExecuteScalar but it is correct on "SQL Entreprise Manager" or "SQL Query Analyser"

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 Enterprise Manager" or "SQL Query Analyser" using the same SQL statement. Thanks in advance. Julio. Here is the SQL statement plus the source to the GetNumOfRow sub.

Visual Basic .NET

6 768

WMI invokemethod

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

Visual Basic .NET

3 6727

C# / SQL Related - what's wrong with this Insert Into syntax?

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 tries to execute the SQL. The strange thing is if i take the exact SQL being executed from the debugger and insert and execute it using the MS Access query engine, it works fine!

C# / C Sharp

18 4341

Calling a function when the number of parameters isn't known till runtime

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 can use dlopen/whatever to convert the function name into a pointer to that function, but actually calling it, with the right number of parameters, isn't easy. As far as I can see, there are only two solutions: 1) This one is portable. If...

C / C++

1 3523

Wrong static initialization order

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 following (with incomplete succes): I want in a given namespace Parameters a list of "initializers" (which are objects derived from a simple interface that can be implemented anywhere, and are used to define which parameters the program will take at...

C / C++

16 7589

Function call with wrong number of parameters

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; }

C / C++

8203

What is ONU?

by: marktang |last post by:

ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...

General

8146

Changing the language in Windows 10

by: Hystou |last post by:

Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

1 8297

The easy way to turn off automatic updates for Windows 10/11

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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...

Windows Server

8449

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...

General

1 6097

Access Europe - Using VBA to create a class based on a table - Wed 1 May

by: isladogs |last post by:

The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...

Microsoft Access / VBA

4063

Trying to create a lan-to-lan vpn between two differents networks

by: TSSRALBI |last post by:

Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

Networking - Hardware / Configuration

1 2579

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

1 1759

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

1445

Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy

by: bsmnconsultancy |last post by:

In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

General

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

To disable or enable advertisem*nts and analytics tracking please visit the page.

InvokeMethod saying wrong number of parameters? | Bytes (2024)

References

Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6508

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.