Code:
Dim FolderBrowserDialog1 As New FolderBrowserDialog
With FolderBrowserDialog1
Desktop is the root folder in the dialog.
.RootFolder = Environment.SpecialFolder.Desktop
.SelectedPath = "c:\windows"
.Description = "Select the source directory"
If .ShowDialog = DialogResult.OK Then
Display the selected folder if the user clicked on the OK button.
MessageBox.Show(.SelectedPath)
End If
End With
Dim files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
For Each filename As String In files
path As String = System.IO.Path.GetFullPath(filename)
If System.IO.Directory.Exists(path) Then
for Each item As String In System.IO.Directory.GetFiles(Path)
If Not ListBox2.Items.Contains(item) Then If item.EndsWith(".mp3") Then ListBox2.Items.Add(item)
If Not ListBox2.Items.Contains(item) Then If item.EndsWith(".mp4") Then ListBox2.Items.Add(item)
If Not ListBox2.Items.Contains(item) Then If item.EndsWith(".flac") Then ListBox2.Items.Add(item)
Next
Else
If Not ListBox2.Items.Contains(Path) Then ListBox2.Items.Add(Path)
End If
Next
Ik heb dus een button met het aanroepen van een folder hetgeen ook gebeurd. Vervolgens klik ik de folder aan en wil filteren op muziekfiles .
In de code zit een fout en namelijk onderstaande:
Code:
Dim files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
De fout is dus e.date
Laatst bewerkt door een moderator: