Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

I have a Public Structure that contains some arrays that their Data Types are other public structures:

VB
Public Structure ResponseInfo
    Public Status As string
    Public Result() As Result
End Structure

Public Structure Result
    Public Type() As String
    Public FormattedAddress() As String
    Public AddCom() As AddressComponent
    Public Geometry As Geometry
End Structure

Public Structure AddressComponent
    Public Long_name As String
    Public short_name As String
    Public type() As String
End Structure


The number of Indexes of the arrays are different in any request.

  Dim Lo_ResponseInfo as ResponseInfo
    Do While Name <> ""
      ReDim Lo_ResponseInfo.Result(Lnum_ResultCounter).AddCom(Lnum_AddComCounter).type(Lnum_AddComTypeCounter)
                                            Lo_ResponseInfo.Result(Lnum_ResultCounter).AddCom(Lnum_AddComCounter).type(Lnum_AddComTypeCounter) =Lnum_AddComTypeCounter 
                                            
Lnum_AddComTypeCounter += 1
Loop


because of ReDim all my Previous data will be lost.
What should I do??
Posted

1 solution

You could replace your arrays with Lists: that way you could avoid redim completely. Instead, just add new entries as you need them.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900