i had to create a program for a programming class final, it breaks dow like this. i have 2 textboxes for user input, a drivelistbox which is linked to a dirlistbox which is also linked to a filelistbox so the user can choose the drive his music is on then find the folder the music is in and if others are like me you have so much music it takes for ever to find the artist or song you are looking for so i made a button that searchs the filelistbox for files that contain the strings input above in the textboxes and puts the results into a listbox on the far right. now the problem i am running into is i have put a media player control on the form so that when the user clicks the song he/she wants to listen to it will play in the media player control, the file in the listbox apparently does not have the path for the file so the media player will not play the selected file if someone could please help me out with the coding to allow the media player to trace the filepath so that the file playes i would be very very greatful.
music finder
Collapse
X
-
Tags: None
-
Originally posted by sniperelitei had to create a program for a programming class final, it breaks dow like this. i have 2 textboxes for user input, a drivelistbox which is linked to a dirlistbox which is also linked to a filelistbox so the user can choose the drive his music is on then find the folder the music is in and if others are like me you have so much music it takes for ever to find the artist or song you are looking for so i made a button that searchs the filelistbox for files that contain the strings input above in the textboxes and puts the results into a listbox on the far right. now the problem i am running into is i have put a media player control on the form so that when the user clicks the song he/she wants to listen to it will play in the media player control, the file in the listbox apparently does not have the path for the file so the media player will not play the selected file if someone could please help me out with the coding to allow the media player to trace the filepath so that the file playes i would be very very greatful.
Code:Dim sPath As String sPath = FileListBox1.Path & "\" & FileListBox1
-
Originally posted by VBWheatiesYou want to combine the FileListBox text with the FileListBox.Pat h property to get the full path to the file:
Code:Dim sPath As String sPath = FileListBox1.Path & "\" & FileListBox1
Comment
-
now there is only one other thing i need to do with it and that is to make it go to the next song in the list. any ideas on how to do that???Comment
-
Originally posted by sniperelitenow there is only one other thing i need to do with it and that is to make it go to the next song in the list. any ideas on how to do that???
Not being sure, I just looked at the controls events so experiment with the MANY events this control has.
To see the events, simply double-click the media player control in the designer and click the drop down at the top-right. You'll have to take it from there. Hope that helps.Comment
-
i have tryed several different declaration for the media player and still nothing atm the listbox and media player private subs looks like this...
Private Sub lbResults_Selec tedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lbResults.Selec tedIndexChanged
Dim path As String = Me.FileListBox1 .Path & "\" & Me.lbResults.Se lectedItem
AxWindowsMediaP layer1.URL = path
AxWindowsMediaP layer1.Ctlcontr ols.play()
End Sub
Private Sub AxWindowsMediaP layer1_PlayStat eChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOC XEvents_PlaySta teChangeEvent) Handles AxWindowsMediaP layer1.PlayStat eChange
If AxWindowsMediaP layer1.playStat e = WMPLib.WMPPlayS tate.wmppsMedia Ended Then
If Me.lbResults.Se lectedIndex < Me.lbResults.It ems.Count - 1 Then
Me.lbResults.Se lectedIndex = Me.lbResults.Se lectedIndex + 1
Else
Me.lbResults.Se lectedIndex = 0
End If
End If
End Sub
after this runs through it goes to the next song in the listbox and says opening media but nothing happens...Comment
-
Originally posted by sniperelitei have tryed several different declaration for the media player and still nothing atm the listbox and media player private subs looks like this...
Private Sub lbResults_Selec tedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lbResults.Selec tedIndexChanged
Dim path As String = Me.FileListBox1 .Path & "\" & Me.lbResults.Se lectedItem
AxWindowsMediaP layer1.URL = path
AxWindowsMediaP layer1.Ctlcontr ols.play()
End Sub
Private Sub AxWindowsMediaP layer1_PlayStat eChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOC XEvents_PlaySta teChangeEvent) Handles AxWindowsMediaP layer1.PlayStat eChange
If AxWindowsMediaP layer1.playStat e = WMPLib.WMPPlayS tate.wmppsMedia Ended Then
If Me.lbResults.Se lectedIndex < Me.lbResults.It ems.Count - 1 Then
Me.lbResults.Se lectedIndex = Me.lbResults.Se lectedIndex + 1
Else
Me.lbResults.Se lectedIndex = 0
End If
End If
End Sub
after this runs through it goes to the next song in the listbox and says opening media but nothing happens...
Code:AxMediaPlayer1.AutoStart = False
Comment
-
-
Originally posted by sniperelitewith the controle i use "AxWindowsMedia Player1" the autostart option is not available.
Comment
-
ok i went and downloaded and installed windows media player 11 sdk and took a look at the information it provided and am now more confused than befor lol if you could give me some guidence on where to look withing the information that would be a great help. again i would like to thank you for all your help.Comment
-
Originally posted by snipereliteok i went and downloaded and installed windows media player 11 sdk and took a look at the information it provided and am now more confused than befor lol if you could give me some guidence on where to look withing the information that would be a great help. again i would like to thank you for all your help.
Then, here is the google results with developers that have developed similarly:
Comment
-
i thank you for your extensive help, i have looked over all the provided links and for some reasion i still cant figure out how to get it to load the next song in the listbox. it selects it and says loading media but never plays it, i tryed a do while loop but that didnt work any other ideas???Comment
Comment