Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB array to managed Code, HELP!

VB array to managed Code, HELP!

Scheduled Pinned Locked Moved Visual Basic
helpcsharpcomdata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark Willems
    wrote on last edited by
    #1

    I'm writing a com callable wrapper to make it possible for vb6 developers to call the new objects written in C#. I have trouble to pass an array of any kind from vb6 to the .Net object. this is the method in c#: public string TestMethod(string[] str) and the call in vb6 is: str2 = secAccess.TestMethod(str) and then i get the following compiler error: Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic. I also tried to use [MarshalAs(UnmanagedType.SafeArray)] in the C# call but I get the same error. Can somebody help me with this problem. Please send an answer to mark.willems@rabobank.com regards, Mark

    A 1 Reply Last reply
    0
    • M Mark Willems

      I'm writing a com callable wrapper to make it possible for vb6 developers to call the new objects written in C#. I have trouble to pass an array of any kind from vb6 to the .Net object. this is the method in c#: public string TestMethod(string[] str) and the call in vb6 is: str2 = secAccess.TestMethod(str) and then i get the following compiler error: Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic. I also tried to use [MarshalAs(UnmanagedType.SafeArray)] in the C# call but I get the same error. Can somebody help me with this problem. Please send an answer to mark.willems@rabobank.com regards, Mark

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      I figured out what the answer is. To be compatible with COM you should pass the array By Ref instead of By Val(which is the default in .NET).:laugh:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups