Sub barPosition_ValueChanged (Value As Int, UserChanged As Boolean)
If UserChanged = False Then Return 'the value was changed programmatically
MediaPlayer1.Position = Value / 100 * MediaPlayer1.Duration
If MediaPlayer1.IsPlaying = False Then 'this can happen when the playback reached the end and the user changes the position
MediaPlayer1.Play
End If
timer1_Tick 'immediately update the progress label
End Sub