Ok well, I have a list, a WMP, and a "Sample" button. I have put some code for the sample button to play but idk really know how to get the WMP to play the file selected in the list.. Help would be very appreciated.
--------------------------------------------------------------------------------------------
Private isPlaying As Boolean
Private Sub ListFiles(strPath As String, Optional Extention As String)
Dim File As String
If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"
If Trim$(Extention) = "" Then
Extention = "*.*"
ElseIf Left$(Extension, 2) <> "*." Then
Extention = "*." & Extention
End If
File = Dir$(strPath & Extention)
Do While Len(File)
List1.AddItem File
File = Dir$
Loop
End Sub
Private Sub cmdSample_Click()
isPlaying = False
If isPlaying = True Then
WindowsMediaPlayer1.Controls.play 'I have this code but i don't really know how to make it play the selected file from list
Timer1.Enabled = True
Else
WindowsMediaPlayer1.Controls.stop
Timer1.Enabled = False
End If
End Sub
Private Sub Form_Load()
ListFiles "C:\Users\Alexiz\Desktop\Preachings", "wav"
ListFiles "C:\Users\Alexiz\Desktop\Preachings", "mp3"
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
WindowsMediaPlayer1.Controls.stop
End Sub
-----------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
Private isPlaying As Boolean
Private Sub ListFiles(strPath As String, Optional Extention As String)
Dim File As String
If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"
If Trim$(Extention) = "" Then
Extention = "*.*"
ElseIf Left$(Extension, 2) <> "*." Then
Extention = "*." & Extention
End If
File = Dir$(strPath & Extention)
Do While Len(File)
List1.AddItem File
File = Dir$
Loop
End Sub
Private Sub cmdSample_Click()
isPlaying = False
If isPlaying = True Then
WindowsMediaPlayer1.Controls.play 'I have this code but i don't really know how to make it play the selected file from list
Timer1.Enabled = True
Else
WindowsMediaPlayer1.Controls.stop
Timer1.Enabled = False
End If
End Sub
Private Sub Form_Load()
ListFiles "C:\Users\Alexiz\Desktop\Preachings", "wav"
ListFiles "C:\Users\Alexiz\Desktop\Preachings", "mp3"
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
WindowsMediaPlayer1.Controls.stop
End Sub
-----------------------------------------------------------------------------------------------------------------