Groups | Blog | Home
all groups > dotnet interop > december 2003 >

dotnet interop : .Net Array of Class in VB6



Jeffrey Cristine
12/12/2003 10:55:15 PM
Why can't I use this class in VB6 with data? I can't Redim it, etc.
You will see that I have an array of class Y as ITEM() in class X.

<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class X
Public ITEM() As Y
End Class

<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class Y
Public Sub_ITEM_A As String
Public Sub_ITEM_B As String
End Class


You see that I have an array of class Y as ITEM() in class X.

I can't access X.ITEM(i).Sub_ITEM_A

I can't: REDIM X.ITEM(1)

How do I access an array of a class within another class that has been =
exported to VB6 from .Net in a .dll type class lib?

Thanks in advance...

Mattias Sjögren
12/14/2003 2:12:35 PM
Jeffrey,

[quoted text, click to view]

Because a COM interface lets you call methods and properties, but not
access data members directly. You should wrap a property around the
data you want to expose. It may also work if you make X and Y
structures.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button