vb.net array

V

vips

how to declare an array with dynamic lenght

dim arr() as string

arr = New String(dt.Columns.Count)



some thing like this ...but this give error

regards

vips
 
V

vips

excellent Cor !!!
it may be easy, but I couldnt find the proper syntax, Now I have it.
thanks a lot .

Vips
 
H

Herfried K. Wagner [MVP]

vips said:
how to declare an array with dynamic lenght

dim arr() as string

arr = New String(dt.Columns.Count)


\\\
arr = New String(dt.Columns.Count - 1) {}
///

- or -

\\\
ReDim arr(dt.Columns.Count - 1)
///

If you want to original content of the array to be copied to the new/resized
array, you can use 'ReDim Preserve'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top