Finding out the length of an array created using Split()
Posted on 2004-08-15
I have got a string which has a list of filenames in it separated by commas, and I have split the string into an array using the Split() function in VB6. As it happens, the string is filled with the list at run time, so I don't actually know how many items the array will have in it. Here is my code so far:
Dim somestring As String
somestring = "DSC00000.JPG,DSC00001.JPG,DSC00002.JPG"
'The above line isn't actually in the code, because if it was I wouldn't have a problem. Instead, the above line would be replaced with a chunk of code to open a text file and get the contents and put them in the string.
thearray = Split(somestring, ",")
I need a way of finding out how many items are inside the array, so that I can write a loop that iterates through the array and uses each individual filename for a purpose. This should be quite a simple question to answer, and any help would really be appreciated.