Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 10th, 2004, 09:06 PM
Authorized User
 
Join Date: Jan 2004
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
Default Finding Files

In my program I want to be able to search for all the executable files in a selected folder and all of it's subfolders. I have a list box (lstFiles) that displays the files and a text box in which the directory to search in is stored (txtDirectory). This is my code. It only searches through the selected folder. It does not search subfolders.
Code:
Dim Files() As FileInfo
Files = New DirectoryInfo(txtDirectory.Text).GetFiles("*.exe")
Dim File As FileInfo

For Each File In Files

    lstFiles.Items.Add(File.FullName)

Next
Thanks in advance.

 
Old October 12th, 2004, 01:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Use a recursive procedure to get the items in the subfolders.

J





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating Excel FIles from resource Files abinashpatra ASP.NET 1.0 and 1.1 Basics 0 July 28th, 2008 02:07 AM
help with finding zeros of ! ludasky Visual Basic 2005 Basics 1 May 1st, 2008 04:08 PM
Finding Records Itzamna VB Databases Basics 3 June 7th, 2005 10:44 AM
Finding the maximum and using it outside the IF jrwarwick XSLT 2 October 17th, 2003 03:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.