Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If (AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped) Then
If (ListBox1.SelectedIndex < ListBox1.Items.Count - 1) Then
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
ListBox1.SelectedItem = ListBox1.SelectedIndex
AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
AxWindowsMediaPlayer1.Ctlcontrols.play()
End If
End If
End Sub
4 Replies - 262 Views - Last Post: 07 February 2012 - 11:06 AM
Topic Sponsor:
#1
I have problem with my mp3 player that im making at the moment
Posted 06 February 2012 - 05:36 AM
Hello,As the topic says i have problem with my mp3 player.I want to make the mp3 palyer auto changing the next song after finishing another but as i tried to do that the only thing that happened was that the same song is repeating over and over.Here is the code i used :
Replies To: I have problem with my mp3 player that im making at the moment
#2
Re: I have problem with my mp3 player that im making at the moment
Posted 06 February 2012 - 06:28 AM
Are you doing anything with the axWindowsMediaPlayer elsewhere in your code? what you have looks like it should work.
Perhaps step through your code and ensure that it is following the logic as you think you have written it. Are you staring the first song somewhere or does the timer handle that? What is the Enum value of the PlayState when the timer is processed? Things like this should give you a better look at what's going on behind the scenes.
For example, if I drag a axWMP control onto a form and check the playstate at runtime, I get an Enum of 0 which is the wmppsUndefined state.
Perhaps step through your code and ensure that it is following the logic as you think you have written it. Are you staring the first song somewhere or does the timer handle that? What is the Enum value of the PlayState when the timer is processed? Things like this should give you a better look at what's going on behind the scenes.
For example, if I drag a axWMP control onto a form and check the playstate at runtime, I get an Enum of 0 which is the wmppsUndefined state.
This post has been edited by CharlieMay: 06 February 2012 - 06:31 AM
#3
Re: I have problem with my mp3 player that im making at the moment
Posted 06 February 2012 - 07:11 AM
try put your code in AxWindowsMediaPlayer1_PlayStateChange event.
Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange 'now change url End Sub
#4
Re: I have problem with my mp3 player that im making at the moment
Posted 06 February 2012 - 01:30 PM
You don't need to set SelectedItem upon changing SelectedIndex - getting SelectedItem returns the item at the index of SelectedIndex. (0-based)
#5
Re: I have problem with my mp3 player that im making at the moment
Posted 07 February 2012 - 11:06 AM
Thanks all for helping seem like i've got it
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|