Berrilicious
Member
- Joined
- Apr 14, 2009
- Messages
- 12
- Programming Experience
- 1-3
I need to return an array but the array size will change from one call of the function to another so I need away to storing the returned array.
The function is as below, and as you can see the returned array will be of different sizes:
Could anyone shed some light?
Kind regards.
The function is as below, and as you can see the returned array will be of different sizes:
VB.NET:
For Each Wallbracket In WallbracketCollection
If Wallbracket.s75x75() = True Then
If i > 0 Then
'Make copy of array before ReDim
Array.Copy(SuitableWallbrackets, SuitableWallbracketsHolder, i)
'ReDim to allow another value
ReDim SuitableWallbrackets(i)
'Add original values back
Array.Copy(SuitableWallbracketsHolder, SuitableWallbrackets, i)
'Add new wallbracket
SuitableWallbrackets(i) = Wallbracket.Model
'ReDim holder to allow copy of newly added value.
ReDim SuitableWallbracketsHolder(i)
i = i + 1
Else
Dim Model As String = Wallbracket.Model
SuitableWallbrackets(i) = Model
i = i + 1
End If
End If
Next
Return SuitableWallbrackets
Could anyone shed some light?
Kind regards.
Last edited: