Arghyle
2009-05-27 21:36:12 UTC
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;
}
Assume I allocated 5 items for the array in the constructor. Now
let's say I'm in VB6 and assume I've created an instance of MyClass
called MyObject. When trying to access the member field like so:
MyObject.myArray(1) results in "Function or interface marked as
restricted, or the function uses an Automation type not supported in
Visual Basic".
I'm pretty sure it's marshalling properly - the VB Object Browser
knows that.myArray is an array of Booleans.
Also, I can do a uBound on myArray and get the correct # of allocated
items. But when I try to access those items - kaboom.
I'm pretty sure I'm not the first person to attempt something like
this. I've read some posts that said if I were passing the array as a
parameter, marking it as 'ref' would resolve the problem. BUT, I'm
just trying to access the property directly so that won't work.
Anybody have any insights they can share with me? Thanks much!
bool array. Looks kinda like this:
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]public MyClass
{
public bool[] myArray;
}
Assume I allocated 5 items for the array in the constructor. Now
let's say I'm in VB6 and assume I've created an instance of MyClass
called MyObject. When trying to access the member field like so:
MyObject.myArray(1) results in "Function or interface marked as
restricted, or the function uses an Automation type not supported in
Visual Basic".
I'm pretty sure it's marshalling properly - the VB Object Browser
knows that.myArray is an array of Booleans.
Also, I can do a uBound on myArray and get the correct # of allocated
items. But when I try to access those items - kaboom.
I'm pretty sure I'm not the first person to attempt something like
this. I've read some posts that said if I were passing the array as a
parameter, marking it as 'ref' would resolve the problem. BUT, I'm
just trying to access the property directly so that won't work.
Anybody have any insights they can share with me? Thanks much!