VB Code:
  1. 'Code description: Gets the number of
  2. 'files in a directory using the fileStystemObject
  3. 'And the Drive listbox and Dir listbox controls.
  4. 'Add a reference to Microsoft Scripting Runtimes
  5.  
  6. Option Explicit
  7.  
  8. Dim fso As New FileSystemObject
  9. Dim fol As Folder
  10.  
  11. Private Sub Command1_Click()
  12. Set fol = fso.GetFolder(Dir1.Path)
  13. MsgBox (fol.Files.Count)
  14. Set fol = Nothing
  15. End Sub
  16.  
  17. Private Sub Drive1_Change()
  18. Dir1.Path = Drive1.Drive
  19. End Sub