Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Newbie question re vb.net and iterating files
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="James Hahn, post: 12832019"] The following fragment will copy matching files into listbox 1 and all subfolders into listbox2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GetFolderFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments) End Sub Sub GetFolderFiles(ByVal Folder) Dim di As New System.IO.DirectoryInfo(Folder) For Each fi As System.IO.FileInfo In di.GetFiles("*.BAT") ListBox1.Items.Add(fi.FullName) Next For Each FoundFolder In di.GetDirectories Try ListBox2.Items.Add(FoundFolder.FullName) GetFolderFiles(FoundFolder.FullName) Catch MsgBox("Error accessing folder " & FoundFolder.FullName) End Try Next End Sub [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Newbie question re vb.net and iterating files
Top