HighTechTalks DotNet Forums  

Re: Accessing C# arrays in VB6 results in "Function or interface m

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Re: Accessing C# arrays in VB6 results in "Function or interface m in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Arghyle
 
Posts: n/a

Default Re: Accessing C# arrays in VB6 results in "Function or interface m - 06-22-2009 , 02:09 PM






FYI: Marshalling it differently was indeed the trick. Many thanks!

"Giovanni Dicanio" wrote:

Quote:
"Arghyle" <JamesPaulHart (AT) gmail (DOT) com> ha scritto nel messaggio
news:7b0d4ce2-0cd3-452e-93f4-69bb9fe9c5c3 (AT) v4g2000vba (DOT) googlegroups.com...
Ok - 10,000 foot view... I have a C# class that exposes a public
bool array. Looks kinda like this:

[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]public MyClass
{
public bool[] myArray;
}

[...]
I'm pretty sure it's marshalling properly - the VB Object Browser
knows that.myArray is an array of Booleans.

Following Ben's suggestion about differentiation between VB6 Boolean vs.
..NET Boolean, you may want to try with a MarshalAs setting like this for
your 'bool[] myArray' public property:

[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BOOL)]

Or you could just export a pair of getter/setter public methods to expose
the array property, e.g.

public bool GetMyArray(int index)

public void SetMyArray(int index, bool value)

HTH,
Giovanni


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.