CodeItBetter Programming Another VB Programming Blog

How to resize an array without losing its contents

Posted on October 19, 2011
1
2
3
4
5
6
7
8
9
10
11
12
'Arrays, Collections, Lists - How to resize an array without losing its contents
'use the ReDim Preserve command:

ReDim Preserve Customers(2000) As String
 
'when you're using ReDim Preserve on a multidimensional array, you can 
'resize only its last dimension:

ReDim Cells(1 To 100, 10) As Integer
 
ReDim Preserve Cells(1 To 100, 20) As Integer    ' This works.
ReDim Preserve Cells(1 To 200, 20) As Integer    ' This doesn't.
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.