Changes

Jump to: navigation, search

Visual Basic Arrays

599 bytes added, 18:46, 3 August 2007
Finding the Size of an Array
intArraySize = strColors.Length
</pre>
 
== Changing the Size of a Visual Basic Array ==
 
Once an array has been declared, its size can be changed using the Visual basic ''ReDim'' keyword. Unfortunately, the ''ReDim'' does not really resize the existing array, rather it destroys the array and re-creates it. This means that all the data in the array is lost. ''ReDim'' is useful for re-using an existing array, but of little use in terms of dynamically resizing that array since all data is lost.
 
The following Visual Basic code changes the size of an array:
 
<pre>
Dim strColors() = {"Red", "Green", "Blue"}
 
ReDim strColors(10)
</pre>

Navigation menu