Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: ReDim Problems


Message #1 by "Jonathan Allen" <jonathan.allen@c...> on Fri, 9 Mar 2001 11:19:23
This is info from MSDN:

Only the upper bound of the last dimension in a multidimensional array can
be changed when you use the Preserve keyword; if you change any of the other
dimensions, or the lower bound of the last dimension, a run-time error
occurs. Thus, you can use code like this:
ReDim Preserve Matrix(10, UBound(Matrix, 2) + 1)
But you cannot use this code:
ReDim Preserve Matrix(UBound(Matrix, 1) + 1, 10)


In your case your First dimension was 4 and you are trying to redim to 2
-----Original Message-----
From: Jonathan Allen [mailto:jonathan.allen@c...]
Sent: Friday, March 09, 2001 6:19 AM
To: professional vb
Subject: [pro_vb] ReDim Problems


i have this code:
     If intLiveRecord > UBound(strAppSettings, 2) Then
            Debug.Print UBound(strAppSettings, 1)
            Debug.Print UBound(strAppSettings, 2)
            Debug.Print intLiveRecord
            Stop
            ReDim Preserve strAppSettings(2, intLiveRecord)
      End If
where the debug prints 4,2,3 but the ReDeim line causes error 9 - 
subscript out of range
why?

  Return to Index