passing array to com object

P

poptcat

Hi. I need to call a com function which requires an array of string as
parameter.
I call it this way:
my.InvokeMember("report", BindingFlags.InvokeMethod, null,
myap,mysir);
where
- myap is the com server
- report is the function
- mysir is an array of strings

In this case "report" receives just the first element of mysir as
parameter and not the whole array.
What's wrong?
Gabriel
 
M

Mr. Arnold

Hi. I need to call a com function which requires an array of string as
parameter.
I call it this way:
my.InvokeMember("report", BindingFlags.InvokeMethod, null,
myap,mysir);
where
- myap is the com server
- report is the function
- mysir is an array of strings

In this case "report" receives just the first element of mysir as
parameter and not the whole array.
What's wrong?


You can't pass an array like that to a Com object I don't think From what I
understand, it has to be passed as a type of Object, look it up use Google.
 
N

Nicholas Paldino [.NET/C# MVP]

Is this array a SAFEARRAY or is it a C-style array? If it is a C-style
array, you are going to have to marshal the array manually to the method
(that is, if you expect the method to change the elements in it and pass it
back).
 

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

Top