473,396 Members | 1,875 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.

Invoke method / Late binding / passing ref variables to a method??

PJ
Hello,

I am trying to use late binding to call a COM object.

I am trying to call a 'GetTables' method on the object.
It's essentially a 'MetadataService' which is used to
return the names of tables which are in a specific
database.

the first parameter to GetTables is "in only" (it's a
short - constant which defines types/categories of tables
to look for)

the second parameter is "in/out" (i.e. ref - "array of
objects" used to return the tablenames found for the
specified tables)

What do I need to do in order to invoke this? with two
different types of parameters?

Here's what I have so far...

==== Code begin ====

.... other code here...

try
{
Type metadataservice;
object[] parameter=new object[1];
object MDSvc;
//get a metadataservice object
metadataservice = Type.GetTypeFromProgID
("GMService.MetadataService");

//create an instance of the metadataservice
MDSvc = Activator.CreateInstance(metadataservice);

//Set the parameter I want to set
parameter[0] = objConn;

//Set the Connection Property
metadataservice.InvokeMember("Connection",
BindingFlags.SetProperty, null, MDSvc, parameter);

object[] args = new object[2];
args[0] = MetadataTableConstants.gmmtAnySpatial;

//not sure what to put here (or if this is correct syntax)
args[1] = String.Empty;

//try to invoke the GetTables() method
metadataservice.InvokeMember("GetTables",
BindingFlags.InvokeMethod, null, MDSvc, args);

==== Code end ====

Nov 15 '05 #1
0 4364

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

Similar topics

21
by: Mike MacSween | last post by:
Had some trouble with Word automation. Sorted it, in the process thought I would try late binding. Some people reccomend it. So this: *********************************************************...
1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
4
by: KC | last post by:
I'm trying to export data to Excel, and I found an example routine at microsoft, but I get an "Option Strict On disallows late binding." at 'oBook = oExcel.Workbooks.Add'. Without turning Option...
7
by: stephan querengaesser | last post by:
hi ng, i try to invoke a webservice-method with an filter-object, that contains value types. if i don´t want to filter the return value of the method, i have to pass a new instance of the...
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
9
by: Miro | last post by:
VB 2003 and Im still new to vb, so i hope i can explain this as best I can. I have a variable defined as such: ( simple example ) Dim AVariableOfSorts(,) As Object = _ { _ {"Last", "String",...
9
by: Grant Schenck | last post by:
Hello, I have a base class with several derived classes: ScriptBase + ScriptCallInbound + ScriptCallOutbound I then have another class: Line
14
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late...
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
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
marktang
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,...
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.