How to declare arraylist in vb6.0

Hi,
Need to declare arraylist in vb6.0.
I have  text file in which I find certain strings and want to store it in array.I do not know the number of string that will be found in the file.

Regards
RIASAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rahul GuptaConnect With a Mentor Commented:
try this

dim mArray() as string
dim nCount as long


loop start

redim preserve mArray(0 to nCount)

read the string from the file

insert the string in the mArray

mArray(nCount)="String"

After that update the nCount
nCount=nCount +1


loop


0
 
RIASAuthor Commented:
Fantastic mate!!!!Cheers
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Use a Collection instead as it will grow dynamically to accommodate your new entries...

    Dim col As New Collection
    ...
        ' for each thing you want to add:
        col.Add something


    ' when you want to iterate over them:
    Dim itm As Variant
    For Each itm In col
        Debug.Print itm
    Next
0
All Courses

From novice to tech pro — start learning today.