filesystemobject question
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: filesystemobject question

  1. #1
    Join Date
    Dec 2008

    filesystemobject question

    im using the filesystemobject to search for files in a folder and susbfolders then show these files in a listbox but when my form loads and executes the search the listbox fills with every file in the app.path how can i limit this to show .exe files and not everything else

    heres my code im using

     form load event
    ListFolder App.Path
    then in

    Private Sub ListFolder(sFolderPath As String)
        Dim FS As New FileSystemObject
        Dim FSfile
        Dim FSfolder As Folder
        Dim subfolder As Folder
        Set FSfolder = FS.GetFolder(sFolderPath)
        For Each FSfile In FSfolder.Files
            SelectionList.AddItem FSfile     'im sure i have to change this but its not having any of it
        Next FSfile
        For Each subfolder In FSfolder.SubFolders
                Call ListFolder(subfolder.Path)
        Next subfolder
        Set FSfolder = Nothing
    End Sub
    ive tried to change the code to find .exe only but to no avail

    thanks for any help

  2. #2
    Join Date
    Apr 2009

    Re: filesystemobject question

    If UCase(Right(FSfile, 3)) = "EXE" Then SelectionList.AddItem FSfile

    Good Luck

  3. #3
    Join Date
    Dec 2008

    Re: filesystemobject question

    excellent thankyou very much

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center