How to work with string()()

45 views Asked by At

I have a string()() array that it must be redim in for loop.So How can i do this. A code like this.

dim arr as string()()=nothing
dim z as integer=nothing
for i= 1 to 5
  for j=0 to 536
      if j mod i =0 then
           redim preserve arr(z)(i)=i.tostring
           z+=1
      end if
   next
next
2

There are 2 answers

0
Sean Phillips On

Here is a good reference on Redim. Do not forget to preserve your values.

https://msdn.microsoft.com/en-us/library/w8k3cys2.aspx

0
mda mda On

I found that i must redim arr step by step like below:

redim arr(z)
redim arr(z)(i)