i am using the directory.getfiles feature. I have 169 files i am sifting through to grab filenames that match user input. My array is folderFiles that is setup for 200 slots. No matter what i do, when i run this line of code:
folderFiles = System.IO.Directory.GetFiles(folderPath)
I get index out of bounds alarm. Well i put a break point at the above line of code and it shows a length of 201. I believe this is creating the alarm BUT i don't know what to do. I have changed the array length and it is ALWAYS 1 more than what i set my array size to. It makes no sense to me, do i just need to error trap? Help? Below is a snippet of code. It errors when i go to access the array in the 'if' statement.
Do Until n = 200
folderFiles = "NA"
n = n + 1
Loop
n = 0
'format date
x1 = Format(Now, "MMddyyyy")
'get file names
folderFiles = System.IO.Directory.GetFiles(folderPath)
'outside loop sifts through filenames retreived from "folderPath" string array
Do Until n = 169
If folderFiles <> "NA" Then
n4 = n4 + 1
End If
n = n + 1