I have a .NET assembly that has routines that need to be called from a VB6 dll. The .NET assembly's routines, for other .NET code will return Lists of objects. However that won't work for VB6. So I am using Interop to create a "vb6 class" that will return the data needed. I had read that the VB.NET Collection is compatible with the VB6 Collection, but I've found that to be untrue. My simple test consists of:
.NET Code:
<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class MyCOMClass
Public Function TestMe() As Microsoft.VisualBasic.Collection
Dim ret As New Microsoft.VisualBasic.Collection
Dim inParam As String = "Stuff "
ret.Add(inParam)
ret.Add(inParam & "2")
ret.Add(inParam & "3")
ret.Add(inParam & "4")
Return ret
End Function
End Class
VB6:
Dim a As MyDotNet.MyCOMClass
Set a = New MyDotNet.MyCOMClass
Dim c As Collection
Set c = a.TestMe()
At this line, I'm receiving a "Type Mismatch, Error 13" error.
I'm kind of at a loss. I basically need to return a list or array of items from the .NET code - I'm already going to have to pack the existing .NET class object into a string or something to return to VB6 (which will then have to unpack it), so I was trying to make it slightly easier on myself.
Any suggestions or hints will be appreciated!
Thanks.