I'm having an issue with this code:
Imports System.IO
Namespace Storage
Class Folders
Public Music As String()
End Class
End Namespace
Public Class FilesFinder
Sub Finder() Handles Find.Click
Dim TempFolder As New Storage.Folders
If FolderDialog.ShowDialog = DialogResult.OK Then
With TempFolder
.Music = Directory.GetFiles("C:\Music", "*.MP3", SearchOption.TopDirectoryOnly)
If .Music IsNot Nothing Then
For Each mp3 As String In .Music
MusicList.Text += "The files: " & mp3 & " was found" & vbCrLf
Next
Else
MusicList.Text += "Music files were not found!"
End If
End With
End If
End Sub
End Class
The problem is, when there are .MP3 files it works as intended, but when there's not any .MP3 file, it doesn't show the "Music files were not found!" message :/ I don't know what's wrong with my logic or the code itself...
Aucun commentaire:
Enregistrer un commentaire