Ok ok... I have been staring at this for a generation or so now and it
is not working. And it is something really simple too. I have a
listbox of mp3s (flbMp3s). I have a textbox (txtSearch). I have the
directory of the mp3s (System.IO.Directory.GetFiles). I want to
search the directory from the text in the textbox, adding to the
listbox if there is a match. I have tried
file.IndexOf(txtSearch.Text), file.Contains(txtSearch.Text), and even
InStr(file, txtSearch.Text).
What am I missing? Is there an easier way to do this? I just want to
search for specific artists, songs, etc. This isn't hard... WHAT IS
GOING ON!!! heh.
Thanks,
Josh
Dim file As String
Dim mp3sPath As String = flbMp3s.Path
If (txtSearch.Text <> "") Then
'clear listbox
flbMp3s.Items.Clear()
'loading each file in working direcrtory of application
For Each file In
System.IO.Directory.GetFiles(flbMp3s.Path)
'storing the filename into listbox items collection
If (InStr(file, txtSearch.Text) > 1) Then
flbMp3s.Items.Add(file)
End If
Next
End If