Storing Arrays in Variant Array

I’d like to store several string arrays for use later on in the Program. Trying to use Variant(), but not getting the results I expect.

dim strArray() as string
dim var() as variant

While (something)
// Stuff
strArray.Append data
wend

var.append strArray
redim strArray(-1)

Somewhere else…

dim s() as string
s = var.pop

What’s the best way to store an array of arrays? Then retrieve them later.

Thanks, JD

This line empties you’re array:

redim strArray(-1)

Delete it and it will run properly.

The problem is, you are storing a reference to your string array, not a copy, so when you later clear it with the redim, you are clearing the original array.

If you want a brand new array, do something like this instead:

strArray = Array( "" )
redim strArray( -1 )

[quote=68828:@Jordan Davis]I
What’s the best way to store an array of arrays? Then retrieve them later.
[/quote]
Quite literally - don’t
Design a class intended to hold your data and use that instead

Then make an array of those

You’ll be better off in the long run

Thanks Norman . . . needs a trick: if you have a two dimensional array in the class, you can’t redimension the array from your primary code. You need to put a method in the class that redimensions the array:

two dimensional array in the class:

redim beamSeries(beamSeries.ubound).series(ubound(beamSeries(beamSeries.ubound).series,1)+1,2)