CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Location
    Madrid (Spain)
    Posts
    1

    Retrieve file list from cd

    how can i get the list of all the files in a cd.I would like to store the information of every cd in a file.


  2. #2
    Join Date
    Jan 2000
    Location
    CA
    Posts
    52

    Re: Retrieve file list from cd

    Try this:

    This code is designed to allow you to select any drive and directory and will copy entries from a FileListBox into a standard ListBox. (You can use similar techniques to copy the list of files from the FileListBox into any other receptacle, including text files, databases, etc...)

    1) Start a new project (Standard .exe)
    2) Add a DriveListBox, a DirectoryListBox, and a FileListBox to Form1. Add a Command Button to your form. Add a ListBox Control to your form.

    3) Insert the following code into Form1:

    option Explicit

    private Sub Command1_Click()
    Dim myIndex as Integer
    With List1
    Do While myIndex < File1.ListCount
    .AddItem File1.List(myIndex)
    myIndex = myIndex + 1
    Loop
    End With
    End Sub

    private Sub Dir1_Change()
    File1.Path = Dir1.Path
    End Sub

    private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
    End Sub





    4) run the project and select the drive identity for your CD Rom (usually D and then select any directory name that may exist on the CD. Your list of files in that directory will appear in the FileListBox. You can copy the names of the files into the ListBox by clicking on the Command Button.

    Good Luck



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured