473,326 Members | 2,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

how to Automatically select next item in listbox

Hello,
I have a moodest mp3 player which has a playlist as listbox1 which
shows full path or each inserted file.

The problem is, when a media playing is ended, i want my listbox to
select automatically next (under/below) item to continue.

What things can i add to that code:

If Me.AxWindowsMediaPlayer1.playState =
WMPLib.WMPPlayState.wmppsMediaEnded Then
End if

Sep 28 '07 #1
10 16754
On Sep 28, 11:46 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
Hello,
I have a moodest mp3 player which has a playlist as listbox1 which
shows full path or each inserted file.

The problem is, when a media playing is ended, i want my listbox to
select automatically next (under/below) item to continue.

What things can i add to that code:

If Me.AxWindowsMediaPlayer1.playState =
WMPLib.WMPPlayState.wmppsMediaEnded Then

End if
Shouldn't it be:

Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1

You might want to do an if..then test to make sure you aren't at the
end of the List however.

Thanks,

Seth Rowe

Sep 28 '07 #2
>
Shouldn't it be:

Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1

You might want to do an if..then test to make sure you aren't at the
end of the List however.

Thanks,

Seth Rowe
Hi Seth Rowe,
Great it worked for selection next item, but i couldn't make out how
to automatize. Which event or action can it be assigned to?

If the playing media is stopped due to end of stream:

If Me.AxWindowsMediaPlayer1.playState =
WMPLib.WMPPlayState.wmppsMediaStopped Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1

That code works for a button click action for example, but i want to
automatize selecting next item, without needing to user prompt or user
mouse action. (Like in Windows Media Player's playlist, Winamp's
playlist)

Sep 28 '07 #3
kimiraikkonen,

You need an event from your mediaplayer for this which then can be handled.

Have a look in intelisense of the mediaplayer which there are.

Cor

"kimiraikkonen" <ki*************@gmail.comschreef in bericht
news:11**********************@57g2000hsv.googlegro ups.com...
>
>>
Shouldn't it be:

Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1

You might want to do an if..then test to make sure you aren't at the
end of the List however.

Thanks,

Seth Rowe

Hi Seth Rowe,
Great it worked for selection next item, but i couldn't make out how
to automatize. Which event or action can it be assigned to?

If the playing media is stopped due to end of stream:

If Me.AxWindowsMediaPlayer1.playState =
WMPLib.WMPPlayState.wmppsMediaStopped Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1

That code works for a button click action for example, but i want to
automatize selecting next item, without needing to user prompt or user
mouse action. (Like in Windows Media Player's playlist, Winamp's
playlist)
Sep 28 '07 #4
On Sep 28, 7:42 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
kimiraikkonen,

You need an event from your mediaplayer for this which then can be handled.

Have a look in intelisense of the mediaplayer which there are.

Cor

"kimiraikkonen" <kimiraikkone...@gmail.comschreef in berichtnews:11**********************@57g2000hsv.go oglegroups.com...


Shouldn't it be:
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
You might want to do an if..then test to make sure you aren't at the
end of the List however.
Thanks,
Seth Rowe
Hi Seth Rowe,
Great it worked for selection next item, but i couldn't make out how
to automatize. Which event or action can it be assigned to?
If the playing media is stopped due to end of stream:
If Me.AxWindowsMediaPlayer1.playState =
WMPLib.WMPPlayState.wmppsMediaStopped Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
That code works for a button click action for example, but i want to
automatize selecting next item, without needing to user prompt or user
mouse action. (Like in Windows Media Player's playlist, Winamp's
playlist)- Hide quoted text -

- Show quoted text -
Hi,
I looked avaible events with the help of intellisense but only
AxWindowsMediaPlayer1.enter seems valid, but it does not produce
automatize which i want. But a button click does what i wanted if you
assign button1.click action but, as i said i don't want any user
action as normal.

Thanks for the interest.

Sep 28 '07 #5
On Sep 28, 1:09 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Sep 28, 7:42 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
kimiraikkonen,
You need an event from your mediaplayer for this which then can be handled.
Have a look in intelisense of the mediaplayer which there are.
Cor
"kimiraikkonen" <kimiraikkone...@gmail.comschreef in berichtnews:11**********************@57g2000hsv.go oglegroups.com...
>Shouldn't it be:
>Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
>You might want to do an if..then test to make sure you aren't at the
>end of the List however.
>Thanks,
>Seth Rowe
Hi Seth Rowe,
Great it worked for selection next item, but i couldn't make out how
to automatize. Which event or action can it be assigned to?
If the playing media is stopped due to end of stream:
If Me.AxWindowsMediaPlayer1.playState =
WMPLib.WMPPlayState.wmppsMediaStopped Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
That code works for a button click action for example, but i want to
automatize selecting next item, without needing to user prompt or user
mouse action. (Like in Windows Media Player's playlist, Winamp's
playlist)- Hide quoted text -
- Show quoted text -

Hi,
I looked avaible events with the help of intellisense but only
AxWindowsMediaPlayer1.enter seems valid, but it does not produce
automatize which i want. But a button click does what i wanted if you
assign button1.click action but, as i said i don't want any user
action as normal.

Thanks for the interest.
Hmm... unfortunately I've never to to use the AxWindowsMediaPlayer
active X object so I can't tell you what event to subscribe to. You
might go through the Object Browser and see if you can find any other
events or possible a field or property you can poll to find when it's
finished playing.

Thanks,

Seth Rowe

Sep 28 '07 #6
Then use that button click and place a label before it, "Next to play".

Cor
Sep 29 '07 #7
On Sep 29, 6:34 am, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
Then use that button click and place a label before it, "Next to play".

Cor
But everytime song finishes, user is forced to click next button to go
to next selected song. I want it automatic. Possible?

Sep 30 '07 #8
"kimiraikkonen" <ki*************@gmail.comschrieb
On Sep 29, 6:34 am, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
Then use that button click and place a label before it, "Next to
play".

Cor

But everytime song finishes, user is forced to click next button to
go to next selected song. I want it automatic. Possible?
As Cor and Seth said, if there is no event available, it is not possible
automatically.

You could add a Timer and check the state in it's Tick event. If it is
ended, select the next item (as shown).
Armin

Sep 30 '07 #9
Use timer maybe?

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:86**********************************@microsof t.com...
Then use that button click and place a label before it, "Next to play".

Cor
Oct 9 '07 #10
If I've understood correctly I would have thought the following should do
the trick:

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

Dim Filename As String = ListBox1.SelectedItem
AxWindowsMediaPlayer1.URL = Filename
AxWindowsMediaPlayer1.Ctlcontrols.play()
End Sub

Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object,
ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles
AxWindowsMediaPlayer1.PlayStateChange
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsMediaEnded
Then
If ListBox1.SelectedIndex < ListBox1.Items.Count - 1 Then
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
Else

'Start at the top of the list again if needed

ListBox1.SelectedIndex = 0

End If

End If

End Sub


"Lim Eng Keong" <ad***@infoct.netwrote in message
news:OW**************@TK2MSFTNGP05.phx.gbl...
Use timer maybe?

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:86**********************************@microsof t.com...
>Then use that button click and place a label before it, "Next to play".

Cor

Dec 6 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Neo Geshel | last post by:
I have an Access DB, from which I am going to pull images. Each image has an associated ID, but the ID's are not necessarily sequential (some images may have been deleted, leaving gaps in the list...
5
by: robecflo | last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm developing with windows forms and vb.net, and oracle as a database. At this moment i have a table called amortizaciones, this table...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.