Create and Update Multidimensional Array
Part A:
Dim textArr(noOfFiles -1, maxNoOfItems)
Dim i As Integer, j As Integer
i = 0
j = 0
For i To noOfFiles
textArr(noOfFiles, 0) = getDescr() 'first item of second dimension is
always description
For j To noOfItems
textArr(noOfFiles, j +1) = getItem()
Next j
Next i
Part B:
You would populate the first ListBox with your textArr like so:
Dim i As Integer
For i = 0 To UBound(textArr, 1)
lstBox1.add textArr(i, 0)
Next i
And in your second ListBox's change event, you want something like
this:
Dim indx As Integer
indx = lstBox1.ListIndex
If indx = 0 Then
Dim i As Integer
i = 1
while (i <= UBound(textArr, 2) And (textArr(indx, i) < "")
lstBox2.add textArr(indx, i)
i = i + 1
wend
Else
lstBox2.clear
End If
Regards,
Steve
|