Thank you all for your responses, I think I learned what I needed!
Marking as resolved.
Also, while re-doing some parts of the code, I scrapped the overcomplicated task_mapoutDirectories sub, and came up something I think is worth sharing and that nobody suggested.
Old code:
New codeCode:Private Sub task_MapoutDirectories() Dim var_newList As New List(Of String) : var_newList.AddRange(var_locList) Dim var_tempList As New List(Of String) Dim var_done As Boolean = False Do For Each var_location In var_newList Try 'Permision exceptions can pop up var_tempList.AddRange(Directory.EnumerateDirectories(var_location, "*", SearchOption.TopDirectoryOnly).ToList) Catch ex As Exception End Try Next If var_tempList.Count = 0 Then var_done = True Else var_newList.Clear() var_newList.AddRange(var_tempList) var_dirList.AddRange(var_tempList) var_tempList.Clear() End If Loop Until var_done End Sub
I thought it was too simple, but It works perfectly so farCode:Private Sub sub_mapout() Dim var_index As Integer = 0 While var_dirList.Count <> var_index Try var_dirList.AddRange(Directory.EnumerateDirectories(var_dirList.Item(var_index), "*", SearchOption.TopDirectoryOnly).ToList) : var_index += 1 Catch ex As Exception : End Try End While End Sub![]()





Reply With Quote
