PDA

Click to See Complete Forum and Search --> : Filter a search? *[resolved]*


ProgrammerJon
Feb 7th, 2003, 02:06 PM
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
' make a reference to a directory
Dim di As New IO.DirectoryInfo("c:/")
Dim diArr As IO.DirectoryInfo() = di.GetDirectories()
Dim diar1 As IO.FileInfo() = di.GetFiles()




' list the names of all the subdirectories in the specified directory
Dim dri As IO.DirectoryInfo

'BeginUpdate method freezes painting while you add items
ListBox1.BeginUpdate()
For Each dri In diArr
ListBox2.Items.Add(dri)
Next

'EndUpdate resumes painting of listbox
ListBox1.EndUpdate()

'list the names of all files in the specified directory
Dim dra As IO.FileInfo
For Each dra In diar1
ListBox1.Items.Add(dra)
Next
Dim r As String()
r = IO.Directory.GetDirectories("c:/")
ListBox1.DataSource = r

End Sub

How can I make it so that this program only returns files that have .mp3 extension?

Cander
Feb 7th, 2003, 02:13 PM
.GetFiles(pattern As string)

ProgrammerJon
Feb 7th, 2003, 02:44 PM
Thanks,

another question;
how do you make it so that I searches subdiretories as well?