passing array to com object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • poptcat@yahoo.com

    #1

    passing array to com object

    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.In vokeMethod, 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

  • Mr. Arnold

    #2
    Re: passing array to com object


    <poptcat@yahoo. comwrote in message
    news:1184581940 .625906.78110@n 60g2000hse.goog legroups.com...
    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.In vokeMethod, 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.


    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: passing array to com object

      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).


      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m

      <poptcat@yahoo. comwrote in message
      news:1184581940 .625906.78110@n 60g2000hse.goog legroups.com...
      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.In vokeMethod, 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
      >

      Comment

      Working...