you have to ReDim the array to whatever size you need.
Redim myArr(3)
Printable View
you have to ReDim the array to whatever size you need.
Redim myArr(3)
You need to use ReDim (with Preserve to keep the old contents) first.
VB Code:
Redim Preserve array(1 to 10)
The difference between this and Dim array(1 to 10) is that you can easily make this array bigger.
That's right, you need to ReDim / re-dimention the array and tell vb to add a new element before you can add the entry, this would make your code into :
The preserve part (as mentioned above) keeps your existing element entries, normally, using the ReDim statement on it's own would clear all of the prvious entries & wip the array first!Code:Dim i as integer
dim strArray() as string
i=0
Do until i =3
Redim Preserve strArray(i)
strArray(i)="s"
i=i+1
loop