Reputation: 513
How i can convert this array to an UNLIMITED range array?
Dim multiArray(2, 2) As String
multiArray(0, 0) = "item1InRow1"
multiArray(0, 1) = "item2InRow1"
multiArray(1, 0) = "item1InRow2"
multiArray(1, 1) = "item2InRow2"
I Tryed:
Dim multiArray(,) As String
but i not have succeeded
Upvotes: 0
Views: 868
Reputation: 15630
Use a variable like this. the value of n can be assigned from user/some logic.
Dim n As Integer = 2
Dim str As String(,) = New String(n - 1, n - 1) {}
Upvotes: 2
Reputation: 54532
Arrays by their nature have a finite size, the only way to change it is to Redim / Preserve the array which can be quite costly(see this link) and only redimensions the last dimemension. You may want to look into using something like an ArrayList or another one of the collection classes like the article suggests.
Upvotes: 2