I read setting the parameter ByRef and not ByVal would work but wasn't sure how to set it up. A little tweaking and the vb.net code looks like this:
_
Public Class clsValues
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "095dc64d-141f-46f9-9af2-1c5e633b459b"
Public Const InterfaceId As String = "86ec1f14-1ef4-446d-9172-b92cf260cd16"
Public Const EventsId As String = "1605e412-8b11-4ee0-a34c-9ec04464737f"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Private mSingleString As String
Public Property SingleString() As String
Get
Return mSingleString
End Get
Set(ByVal value As String)
mSingleString = value
End Set
End Property
Private mStringArray As String()
Public Function StringArray() As String()
Return mStringArray.ToArray
End Function
Public Function StringArray(i As Short) As String
Return mStringArray(i)
End Function
Public Sub SetStringArray( ByRef value As String())
mStringArray = value
End Sub
End Class
The final vb6 code looks like this:
Option Explicit
Private Sub btnTest_Click()
Dim x As Integer
Dim strTest(4) As String
strTest(1) = "abc"
strTest(2) = "def"
strTest(3) = "ghi"
strTest(4) = "jkl"
On Error GoTo err1
Dim clsTest As comtest.clsValues
Set clsTest = New comtest.clsValues
clsTest.SingleString = "this is my string"
clsTest.SetStringArray strTest
MsgBox "Single string = " & clsTest.SingleString, vbInformation, "Test"
For x = 1 To UBound(clsTest.StringArray) 'clsTest.UboundStringArray
MsgBox "Multi string " & x & " = " & clsTest.StringArray\_2(x), vbInformation, "Test"
Next x
Exit Sub
err1:
MsgBox "Error: " & Err.Number & vbCrLf & Err.Descrip