Reputation: 324
i have an array that i want to copy in two-dimensional (like jagged) this is my code :
Dim cB(1000000) As Double
Dim buffer(50, 1000000) As Double
For I = 1 To 1000000
cB(I) = CInt(Int((50 * Rnd()) + 1))
Next
I can use a for to copy cB to buffer. like this code :
For I = 1 To 10
For j = 1 To 1000000
buffer(I, j) = cb(j)
Next
Next
but i want to know is there any faster method to do this? in vb.net or C# i could use List. is there some thing like this in vb6.0?
thanks.
Upvotes: 1
Views: 802
Reputation: 6165
There isn't a generic List object in VB6, but there is a Dictionary object which is roughly equivalent to the generic Dictionary object in .Net. Set a reference to "Microsoft Scripting Runtime" and you'll find it.
Upvotes: 1
Reputation: 338178
Maybe don't copy the array at all?
Function AccessMyArray(arr, i, j)
' TODO: add range check using LBound() / UBound()
AccessMyArray = arr(i * 1024 + j)
End Function
Upvotes: 1