Cache a 2-dimensional array

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I can get my 2-dim array to Cache but then I can't get it out
Code:
Dim MyList(,) As String
For Each dr In dtClone.Rows
                    ReDim Preserve MyList(1, j)
                    'Load the array from the datareader
                    MyList(0, j) = CType(dr.Item("D"), String)
                    MyList(1, j) = CType(dr.Item("D_PATH"), String)
                    j += 1
                Next
Cache.Item("MyLIST") = DGNList

And then later on a different event I want to pull these values back out

Code:
Dim AList As Array
        Dim j As Integer

        'Cache Array to local 1-dim array
        AList = CType(Cache("MyLIST"), Array)


        For j = 0 To AList.GetUpperBound(1)
            Dim DName As String
            DName = AList(1, j)
        Next j

I'm getting late bind error on the AList(1,j) line
I have option strict On
I realize I am dimming a 1-dimensional array to receive the Cache object but that is the only thing that would work.
Any suggestions?
What am I missing here?
 
How about something like
Visual Basic:
Dim AList(,) As String
Dim j As Integer

'Cache Array to local 1-dim array
AList = CType(Cache("MyLIST"), String(,))
 
Last edited:
Back
Top