Im having trouble popping elements out of a IO.FileSystemInfo array. I cant use the Remove method so I have to use the Clear method but I think Im messing it up somewhere.
Here is the section of code...
As you can see from the last line the subsequent code is dependent on these two files being removed from the array as they dont need to be considerd but even though the values match up the IndexOf method always returns -1. Ive tried changing types and using the actual string instead of track.name in the IndexOf statement.
Ive just switched from VB6 and Im still getting me head round .NET so any help would be great.
Cheers!
Here is the section of code...
Code:
Dim artistdir As New IO.DirectoryInfo(musicroot & "\" & dir.Name)
Dim tracksArray As IO.FileSystemInfo() = artistdir.GetFiles
Dim track As IO.FileInfo
For Each track In tracksArray
If track.Name = "Thumbs.db" Then
Dim trackindex = tracksArray.IndexOf(tracksArray, track.Name)
tracksArray.Clear(tracksArray, trackindex, 1)
ElseIf track.Name = "Desktop.ini" Then
Dim trackindex = tracksArray.IndexOf(tracksArray, track.Name)
tracksArray.Clear(tracksArray, trackindex, 1)
End If
Next
If tracksArray.Length <> 0 Then.......
As you can see from the last line the subsequent code is dependent on these two files being removed from the array as they dont need to be considerd but even though the values match up the IndexOf method always returns -1. Ive tried changing types and using the actual string instead of track.name in the IndexOf statement.
Ive just switched from VB6 and Im still getting me head round .NET so any help would be great.
Cheers!
Last edited by a moderator: