redim a bidimentional array

altariamx2003
altariamx2003 used Ask the Experts™
on
I got this bidimentional array
Public dispositivos(0, 1) As String

after i fill the array:
        dispositivos(filas, 0) = nodo.Id
        dispositivos(filas, 1) = nodo.tipo
        filas = filas + 1

I tried to redim it with :ReDim Preserve dispositivos(filas, 1), but always visual basic says that I only can redim the right side of the array

I would like to know how to redim the left side of the array only

Best regards
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

Commented:
You can't...thus the message.  Only the LAST dimension can be resized.

Either:
(1) Change the order of your dimensions so the "dynamic" one is in the last slot.
(2) Use something other than an Array to hold your data.

Author

Commented:
can I use collections???

it is posible to use bidimentional collections???
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
Commented:
A List() would work:
http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx

And, yes, you can have a List of Lists:

    Dim data As New List(Of List(Of String))
Top Expert 2011

Commented:
Alternatively, you could store nodo as follows.

Public dispositivos As List(Of Nodo)

dispositivos.Add(nodo)

To retrieve the data would be something like:

dispositivos(2).Id
dispositivos(2).tipo

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial