calfred2808

Collect List of Files and Folders from Directory (Module)

Feb 10th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.72 KB | None | 0 0
  1. Imports System
  2. Imports System.IO
  3.  
  4.  
  5. Module ListOfCollectionMod
  6.     Function MyDirectory()
  7.         Dim MyDir As String = MainForm.txtDirectoryCollectionofFiles.Text
  8.         Return MyDir
  9.     End Function
  10.  
  11.     Public Sub ListOfFolders()
  12.         For Each Dir As String In Directory.GetDirectories(MyDirectory)
  13.             MainForm.txtListOfFiles.Text += (Dir) + vbNewLine
  14.         Next
  15.     End Sub
  16.  
  17.     Public Sub ListOfCollection()
  18.         For Each foundFile As String In My.Computer.FileSystem.GetFiles(MyDirectory)
  19.             MainForm.txtListOfFiles.Text += foundFile + vbNewLine
  20.         Next
  21.     End Sub
  22.  
  23.     Public Sub ListFileDir()
  24.         ListOfFolders()
  25.         ListOfCollection()
  26.     End Sub
  27.  
  28. End Module
Add Comment
Please, Sign In to add comment