how to Automatically select next item in listbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kimiraikkonen

    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.AxWindowsMed iaPlayer1.playS tate =
    WMPLib.WMPPlayS tate.wmppsMedia Ended Then


    End if

  • rowe_newsgroups

    #2
    Re: how to Automatically select next item in listbox

    On Sep 28, 11:46 am, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
    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.AxWindowsMed iaPlayer1.playS tate =
    WMPLib.WMPPlayS tate.wmppsMedia Ended Then
    >
    End if
    Shouldn't it be:

    Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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

    Comment

    • kimiraikkonen

      #3
      Re: how to Automatically select next item in listbox

      >
      Shouldn't it be:
      >
      Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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.AxWindowsMed iaPlayer1.playS tate =
      WMPLib.WMPPlayS tate.wmppsMedia Stopped Then
      Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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)



      Comment

      • Cor Ligthert[MVP]

        #4
        Re: how to Automatically select next item in listbox

        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

        "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr eef in bericht
        news:1190996596 .887719.289920@ 57g2000hsv.goog legroups.com...
        >
        >>
        >Shouldn't it be:
        >>
        >Me.ListBox1.Se lectedIndex = Me.ListBox1.Sel ectedIndex + 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.AxWindowsMed iaPlayer1.playS tate =
        WMPLib.WMPPlayS tate.wmppsMedia Stopped Then
        Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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)
        >
        >
        >

        Comment

        • kimiraikkonen

          #5
          Re: how to Automatically select next item in listbox

          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
          >
          "kimiraikko nen" <kimiraikkone.. .@gmail.comschr eef in berichtnews:119 0996596.887719. 289920@57g2000h sv.googlegroups .com...
          >
          >
          >
          >
          >
          Shouldn't it be:
          >
          Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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.AxWindowsMed iaPlayer1.playS tate =
          WMPLib.WMPPlayS tate.wmppsMedia Stopped Then
          Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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
          AxWindowsMediaP layer1.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.

          Comment

          • rowe_newsgroups

            #6
            Re: how to Automatically select next item in listbox

            On Sep 28, 1:09 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
            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
            >
            "kimiraikko nen" <kimiraikkone.. .@gmail.comschr eef in berichtnews:119 0996596.887719. 289920@57g2000h sv.googlegroups .com...
            >
            >Shouldn't it be:
            >
            >Me.ListBox1.Se lectedIndex = Me.ListBox1.Sel ectedIndex + 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.AxWindowsMed iaPlayer1.playS tate =
            WMPLib.WMPPlayS tate.wmppsMedia Stopped Then
            Me.ListBox1.Sel ectedIndex = Me.ListBox1.Sel ectedIndex + 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
            AxWindowsMediaP layer1.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 AxWindowsMediaP layer
            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

            Comment

            • Cor Ligthert[MVP]

              #7
              Re: how to Automatically select next item in listbox

              Then use that button click and place a label before it, "Next to play".

              Cor

              Comment

              • kimiraikkonen

                #8
                Re: how to Automatically select next item in listbox

                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?

                Comment

                • Armin Zingler

                  #9
                  Re: how to Automatically select next item in listbox

                  "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr ieb
                  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

                  Comment

                  • Lim Eng Keong

                    #10
                    Re: how to Automatically select next item in listbox

                    Use timer maybe?

                    "Cor Ligthert[MVP]" <notmyfirstname @planet.nlwrote in message
                    news:86C3A9B2-49D2-4058-9698-52D90BBB586F@mi crosoft.com...
                    Then use that button click and place a label before it, "Next to play".
                    >
                    Cor

                    Comment

                    • Jerry Spence1

                      #11
                      Re: how to Automatically select next item in listbox

                      If I've understood correctly I would have thought the following should do
                      the trick:

                      Private Sub ListBox1_Select edIndexChanged( ByVal sender As System.Object,
                      ByVal e As System.EventArg s) Handles ListBox1.Select edIndexChanged

                      Dim Filename As String = ListBox1.Select edItem
                      AxWindowsMediaP layer1.URL = Filename
                      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 ListBox1.Select edIndex < ListBox1.Items. Count - 1 Then
                      ListBox1.Select edIndex = ListBox1.Select edIndex + 1
                      Else

                      'Start at the top of the list again if needed

                      ListBox1.Select edIndex = 0

                      End If

                      End If

                      End Sub




                      "Lim Eng Keong" <admin@infoct.n etwrote in message
                      news:OWBdIRoCIH A.5712@TK2MSFTN GP05.phx.gbl...
                      Use timer maybe?
                      >
                      "Cor Ligthert[MVP]" <notmyfirstname @planet.nlwrote in message
                      news:86C3A9B2-49D2-4058-9698-52D90BBB586F@mi crosoft.com...
                      >Then use that button click and place a label before it, "Next to play".
                      >>
                      >Cor
                      >

                      Comment

                      Working...