Passing Multi-Dimensional Arrays

Results 1 to 2 of 2

Thread: Passing Multi-Dimensional Arrays

  1. #1
    Join Date
    Dec 1969

    Default Passing Multi-Dimensional Arrays

    I&#039m trying to use a multidimensional array to store info on 2 people over a period of time. I need to pass this from one page to the next, but when I tried storing it in a session variable, it was stored as a varient and not as an array, so it caused a typemismatch when I tried to pull the info out of the session variable. Is there any way that works to pass a multi-dimension array to another page?

  2. #2
    Join Date
    Dec 1969

    Default RE: Passing Multi-Dimensional Arrays

    You don&#039t show your code, but I&#039d bet that you didn&#039t follow one of two rules:<BR><BR>(1) *ALWAYS* use a dynamically sized array.<BR>(2) *NEVER* declare the receiving variable to be an array.<BR><BR>Thus:<BR><BR>*** PAGE 1 ***<BR><BR>&#060;%<BR>Dim theInfo( )<BR>ReDim theInfo( 10, 2 ) &#039 11 columns, 3 rows, initial size...<BR>... put info into the array ...<BR>Session("saveArrayInfo") = theInfo<BR>...<BR>%&#062;<BR><BR>*** Page 2 ***<BR><BR>&#060;%<BR>Dim savedInfo &#039 note: NOT an array or anything!<BR>savedInfo = Session(""saveArrayInfo")<BR><BR>... note: the reason I put columns first...<BR>... was so I *could* (if I wanted) do ...<BR>ReDim Preserve savedInfo( 10, 7 ) &#039 make array have more rows<BR>Session("saveArrayInfo") = savedInfo<BR>%&#062;<BR><BR>You can *only* change the *last* dim of an array via ReDim preserve, so always make that dim the one you are likely to resize.<BR><BR>Hokay?<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts