.mp3 will not play

  • 13 years ago

    Writing a program to play .mp3 in a specific directory, some will play, but some will not, any help and I will be thank full.

     

    Private Sub Form_Load()
    Credits = 0
    Label1.Caption = Credits
    QueNumber = 0
    Label3.Caption = QueNumber


    Rem Add the songs
    Dim fileList() As String
        Dim fName As String
        Dim fPath As String
        Dim I As Integer
         'define the directory to be searched for files
        fPath = "C:\SONGS\"
         
         'build a list of the files
        fName = Dir(fPath & "*.mp3")
        While fName <> ""
             'add fName to the list
            I = I + 1
            ReDim Preserve fileList(1 To I)
            fileList(I) = fName
             'get next filename
            fName = Dir()
        Wend
         'see if any files were found
        If I = 0 Then
             MsgBox "No files found"
            Exit Sub
        End If
         'cycle through the list and add to  listbox
        For I = 1 To UBound(fileList)
            List1.AddItem fileList(I)
        Next

    SongList(0).Caption = List1.List(Place)
    SongList(1).Caption = List1.List(Place + 1)
    SongList(2).Caption = List1.List(Place + 2)
    SongList(3).Caption = List1.List(Place + 3)
    SongList(4).Caption = List1.List(Place + 4)
    End Sub

    Private Sub Picture1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 113 Then Credits = Credits + 1
    If KeyAscii = 107 Then Place = Place + 1
    If KeyAscii = 104 Then Place = Place - 1
    If Place < -2 Then Place = -2
    If Place > List1.ListCount Then Place = List1.ListCount
    If KeyAscii = 101 Then filetoplay = "C:\SONGS\" + List1.List(Place + 2)
    If KeyAscii = 101 Then Credits = Credits - 1
    If KeyAscii = 101 Then MediaPlayer1.FileName = filetoplay


    SongList(0).Caption = List1.List(Place)
    SongList(1).Caption = List1.List(Place + 1)
    SongList(2).Caption = List1.List(Place + 2)
    SongList(3).Caption = List1.List(Place + 3)
    SongList(4).Caption = List1.List(Place + 4)
    Label1.Caption = Credits
    End Sub

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“XML is like violence - if it's not working for you, you're not using enough of it.”