This code should open an MP3 file into a list box:
[code=vb]
Private Sub btnAddFile_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnAddFile.Clic k
Dim OpenFile As New OpenFileDialog
Dim file As String
OpenFile.Initia lDirectory = "C:\Documen ts and Settings\Matth\ My Documents\test1 \"
OpenFile.Filter = "MP3 Files (*.mp3)|*.MP3"
OpenFile.Restor eDirectory = True
OpenFile.Multis elect = True
If OpenFile.ShowDi alog() = Windows.Forms.D ialogResult.OK Then
For Each file In OpenFile.FileNa mes
Dim sread As New IO.StreamReader (file), s As String() = sread.ReadToEnd ().Split(Chr(10 ))
For Each str As String In s
FileList.Items. Add(str)
Next
Next
End If
End Sub[/code]
Unfortunately, it doesn't open the file in the list box as a '.mp3' file, but it just outputs 'A Music File{}'
could someone help please???
[code=vb]
Private Sub btnAddFile_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnAddFile.Clic k
Dim OpenFile As New OpenFileDialog
Dim file As String
OpenFile.Initia lDirectory = "C:\Documen ts and Settings\Matth\ My Documents\test1 \"
OpenFile.Filter = "MP3 Files (*.mp3)|*.MP3"
OpenFile.Restor eDirectory = True
OpenFile.Multis elect = True
If OpenFile.ShowDi alog() = Windows.Forms.D ialogResult.OK Then
For Each file In OpenFile.FileNa mes
Dim sread As New IO.StreamReader (file), s As String() = sread.ReadToEnd ().Split(Chr(10 ))
For Each str As String In s
FileList.Items. Add(str)
Next
Next
End If
End Sub[/code]
Unfortunately, it doesn't open the file in the list box as a '.mp3' file, but it just outputs 'A Music File{}'
could someone help please???