Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2008

Tip: Looking for answers? Try searching our database.

Return .NET array of objects to COM

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RF - 29 Feb 2008 12:00 GMT
Hi,

I'm trying to create a C# dll that will return an array of objects.

SomeObj[] Func(){...}

The object in question is exposed to COM and I can create it in VB6 with no
problem.

When i look at the type library it shows me that the return type is an array
of the object in question but when I do the call I get a Type Mismatch in VB

Dim arr() as SomeObj

SomeObj = Func()

I tried this instead:
Dim arr as Variant
arr = Func()

This does not generate an error and it sees that it's an array but each
element is defined as unknown type definition.

We defined this in C#

SomeObj Func() {...}

and it works fine.

So why is the array not being marshaled properly

Thanks
Adam - 30 Mar 2008 07:10 GMT
RF,

I haven't worked in this area specifically, but arrays in COM are generally
passed as SafeArrays, so you might start there.

> Dim arr() as SomeObj
>
> SomeObj = Func()

I'm surprised this didn't work.. but then, I don't know VB6/COM.

Adam

> Hi,
>
[quoted text clipped - 28 lines]
>
> Thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.