0

Hello. I am having a problem. I am attempting to gather a group of file names from a directory. I am able to do this. I tested the code by having the list populate into a listbox and all desired items were added to the list.
Here is my code:

Dim di As New IO.DirectoryInfo(strPath)
        Dim dir1 As IO.FileInfo() = di.GetFiles("*.txt")
        Dim dFiles As IO.FileInfo
       ListBox.Items.Add(dFiles)

However, a listbox is not my desired output. I am attempting to write these file names to a text file for purposes of then parsing the information to a datatable to compare with another datatable.
If anyone knows how to get my filenames written to a a textfile I would appreciate it.

Thanks,

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by starlight849
1
Dim strPath As String = "C:\Users\GeekByChoiCe\Desktop\"
IO.File.WriteAllLines("C:\Users\GeekByChoiCe\Desktop\test.txt", IO.Directory.GetFiles(strPath, "*.txt"))
Votes + Comments
Great Help.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.