Hello, Somebody knows if an ArrayList could be bi-dimensional?, or if i have a structure like this: Dim Type(X,Y) ElementList(0) How could i redim this array? Thanks!
ArrayLists can only have one dimension. You can redim this array with" Code: Dim ElementList(10,2) '10 - new size, 2 - number of fields.
it worked, thx... and, could you tell me how i could redim (add or delete elemenst to the array) without lossing the current data? Thanks again!
You will need to manually copy the data each time. Something like: Code: Sub Globals 'Declare the global variables here. Dim Type(x,y) ElementList(0) Dim Type(x,y) TempList(0)End SubSub App_Start 'usage example Redim(10) For i = 0 To 9 ElementList(i).x = i ElementList(i).y = i * 2 Next Redim(100) Msgbox(ElementList(5).x,ElementList(4).y)End SubSub Redim(size) Dim TempList(size,2) For i = 0 To ArrayLen(ElementList())-1 TempList(i).x = ElementList(i).x TempList(i).y = ElementList(i).y Next ElementList() = TempList() 'Both arrays will point to the same array.End Sub Don't call this method periodically. Instead set the array size to be larger than what you currently need (at least twice the size).