Programming2007
Programmer
Hello All I have 4 string arrays and I am trying to copy them all into 1 large array and have an error that the index is out of range.I thought of using an arraylist but then I would have subindexes for each of the add()'s which I am not sure how to manipulate.Below is my code which currently has the error array cannot be null. All I need to do is copy my 4 string arrays into 1 array and need help. How do I do that? Thanks in advance.
Dim curDirectoryHTM As String()
Dim curDirectoryASPX As String()
Dim aspxByDirectory As String()
Dim htmByDirectory As String()
Dim allFiles As String()
Dim dirs As String
Dim directories As String()
curDirectoryHTM = Directory.GetFiles("C:\SCoutline4", "*.htm")
curDirectoryASPX = Directory.GetFiles("C:\SCoutline4", "*.aspx")
curDirectoryASPX.CopyTo(allFiles, allFiles.Length)
curDirectoryHTM.CopyTo(allFiles, allFiles.Length)
directories = System.IO.Directory.GetDirectories("C:\SCoutline4")
Console.Write(dirs)
For Each dirs In directories
htmByDirectory = Directory.GetFiles(dirs, "*.htm")
aspxByDirectory = Directory.GetFiles(dirs, "*.aspx")
htmByDirectory.CopyTo(allFiles, allFiles.Length)
aspxByDirectory.CopyTo(allFiles, allFiles.Length)
Next dirs
'NEED TO COPY ALL 4 OF THESE ARRAYS TO ALLFILES ARRAY
Response.Write(allFiles))
Dim curDirectoryHTM As String()
Dim curDirectoryASPX As String()
Dim aspxByDirectory As String()
Dim htmByDirectory As String()
Dim allFiles As String()
Dim dirs As String
Dim directories As String()
curDirectoryHTM = Directory.GetFiles("C:\SCoutline4", "*.htm")
curDirectoryASPX = Directory.GetFiles("C:\SCoutline4", "*.aspx")
curDirectoryASPX.CopyTo(allFiles, allFiles.Length)
curDirectoryHTM.CopyTo(allFiles, allFiles.Length)
directories = System.IO.Directory.GetDirectories("C:\SCoutline4")
Console.Write(dirs)
For Each dirs In directories
htmByDirectory = Directory.GetFiles(dirs, "*.htm")
aspxByDirectory = Directory.GetFiles(dirs, "*.aspx")
htmByDirectory.CopyTo(allFiles, allFiles.Length)
aspxByDirectory.CopyTo(allFiles, allFiles.Length)
Next dirs
'NEED TO COPY ALL 4 OF THESE ARRAYS TO ALLFILES ARRAY
Response.Write(allFiles))