I'm making an ocx which has properties that call functions which return arrays. It works fine for one dimensional arrays, but not for multidimensional arrays. I get a 'subscript out of range' error from the application which is using the ocx to get multidimensional arrays.
Here is the function:
Public Function GetItemsList() As String()
Dim wI As Integer
Dim x As Integer
Open "WarehouseInventory.dat" For Random As #1 Len = 126
wI = LOF(1) / 126
ReDim Items(1 To wI, 3) As String
For x = 1 To wI
Get #1, x, wItem
Items(x, 1) = wItem.Description
Items(x, 2) = wItem.FluidicPart
Items(x, 3) = wItem.ManufPart
Next x
Close
GetItemsList = Items
End Function
Here is the Get property in the ocx:
Property Get ItemList() As String()
Dim iList() As String
iList = GetItemsList()
End Property
In the application which uses the ocx I have:
Dim iList() As String
iList = Warehouse1.ItemList
here is where I get the error:
For i = LBound(iList) To UBound(iList)
The same process works fine if I put the function directly into the application instead of calling it through the ocx. What am I doing wrong?