Home All Groups Group Topic Archive Search About

Creating a dynamic array in VB NET

Author
26 Jan 2006 4:38 PM
hien_tran
As in VB6, is it possible to create a dynamic array in VB NET and then
use Redim Preserve after knowing the index of the array?  Thank you in
advance for your help.

Author
26 Jan 2006 5:00 PM
nelsonhaha
Yes this is possible, but you may want to consider using ArrayLists in
VB.NET since they are much more efficient.  A good article explaining
the performance difference may be found here:

http://www.aspheute.com/english/20001025.asp

-Nelson
Author
26 Jan 2006 5:37 PM
Herfried K. Wagner [MVP]
hien_t***@ghc-hmo.com wrote:
> As in VB6, is it possible to create a dynamic array in VB NET and then
> use Redim Preserve after knowing the index of the array?  Thank you in
> advance for your help.

In VB.NET each array can be redimensioned using 'ReDim Preserve'.
However, sometimes it's better to use more dynamic data structures like
'ArrayList' or 'List(Of T)' (.NET 2.0).

--
Herfried K. Wagner [MVP]