The following example returns all files in the directory and adds them to ListBox1.
|
For Each foundFile As String In My.Computer.FileSystem.GetFiles _
(My.Computer.FileSystem.SpecialDirectories.MyDocuments)
ListBox1.Items.Add(foundFile)
Next
|
This example requires that you have a ListBox named ListBox1 on your form.
This example returns all files in the directory with the extension .dll and adds them to ListBox1.
|
For Each foundFile As String In My.Computer.FileSystem.GetFiles _
(My.Computer.FileSystem.SpecialDirectories.MyDocuments, _
FileIO.SearchOption.SearchTopLevelOnly, "*.txt")
ListBox1.Items.Add(foundFile)
Next
|
This example requires that you have a ListBox named ListBox1 on your form.