title: Detecting if music has ended in VB.NET
body: <p>Title says it all - I'm in VB.NET and using Windows Media Player as a base for a music player I'm making. I've got the following code to detect if a currently playing .mp3 file has ended:</p>
  
  <pre><code>            'Checks to see if the player is still playing music
              While WMPLib.WMPPlayState.wmppsPlaying
                      If WMPLib.WMPPlayState.wmppsMediaEnded Then
                      MessageBox.Show("Playing next song")
                      End If
              End While
  </code></pre>
  
  <p>The while check can successfully see that a music file is being played, however the IF statement doesn't detected when a music file has ended, it actually returns true whilst the media is currently playing. How can I get it to detect when a music file has finished playing? </p>