Hello guys,
Actually I am working on a software in .NET. The software objectives is to search for all music files in a specifies directory or the whole computer and display the files names in a list box.
But the problem is with the directory. How can I used .Net to scan the whole computer or a "specific directory."
So far, I have been able to scan only special directories:
Public Class frmSpecusAnalyser
Private Sub btnAnalyse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyse.Click
Me.lstMusicFiles.Items.Clear()
Dim numOfFiles As Integer = 0
Dim foundSong As String
Dim progValue As Integer = 0
prgBrAnalyser.Value = 0
For Each foundSong In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments, _
FileIO.SearchOption.SearchAllSubDirectories, "*.mp3*", "*.mp4*")
Me.lstMusicFiles.Items.Add(foundSong)
numOfFiles += 1
If progValue <= 100 Then
prgBrAnalyser.Value = progValue
progValue += 1
End If
Next
lblNumOfFiles.Text = numOfFiles.ToString
If Me.lstMusicFiles.Items.Count < 1 Then
MsgBox("Oops, no music files found!")
End If
End Sub
End Class
Thanks a lot in advance guys.
Regards,
Mike