Mp3 Player problems

mikejs

New member
Joined
Mar 5, 2011
Messages
2
Programming Experience
1-3
Hello I have not coded for a while so i thought I would build an Mp3 player to get the grey cells working again, I have used a number of sources to create what I have so far I am stuck with a few problems this is my entire source

VB.NET:
[COLOR=blue]Imports[/COLOR] System.Drawing
[COLOR=blue]Imports[/COLOR] System.IO
[COLOR=blue]Imports[/COLOR] System.Runtime.InteropServices
[COLOR=blue]Imports[/COLOR] WMPLib
 
[COLOR=blue]Public[/COLOR] [COLOR=blue]Class[/COLOR] [COLOR=#2B91AF]Main[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] Main_Load([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] [COLOR=blue]MyBase[/COLOR].Load
        [COLOR=green]'Dim splash As SplashScreen1 = CType(My.Application.SplashScreen, SplashScreen1)[/COLOR]
        [COLOR=green]'Dim MadeUpSteps() As String = {"Initializing...", "Loading...", "Please wait...", "Nearly done..."}[/COLOR]
 
        [COLOR=green]'For i As Integer = 0 To MadeUpSteps.Length - 1[/COLOR]
        [COLOR=green]'    splash.UpdateProgress(MadeUpSteps(i), CInt((i + 1) / MadeUpSteps.Length * 100))[/COLOR]
        [COLOR=green]'    System.Threading.Thread.Sleep(1500)[/COLOR]
        [COLOR=green]'Next[/COLOR]
        Mwmp.uiMode = [COLOR=#A31515]"none"[/COLOR]
        RadRadioButtonMusic.IsChecked = [COLOR=blue]True[/COLOR]
        RadPanelMediaSelect.Hide()
        RadPanelSound.Hide()
        RadMenuItemSaveList.Enabled = [COLOR=blue]False[/COLOR]
        RadPanelControls.Hide()
        RadButtonPlay.Image = [COLOR=blue]My[/COLOR].Resources.player_play
        RadButtonNext.Image = [COLOR=blue]My[/COLOR].Resources.player_fwd
        RadButtonStop.Image = [COLOR=blue]My[/COLOR].Resources.player_stop
        RadButtonPrev.Image = [COLOR=blue]My[/COLOR].Resources.player_back
        RadButtonPause.Image = [COLOR=blue]My[/COLOR].Resources.player_pause
        TimerScan.Interval = 1000
        TimerUpdateInfo.Interval = 1000
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadRadioButtonMovie_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadRadioButtonMovie.Click
        [COLOR=blue]If[/COLOR] RadRadioButtonMovie.IsChecked = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR]
            RadRadioButtonMusic.IsChecked = [COLOR=blue]False[/COLOR]
 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadRadioButtonMusic_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadRadioButtonMusic.Click
        [COLOR=blue]If[/COLOR] RadRadioButtonMusic.IsChecked = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR]
            RadRadioButtonMovie.IsChecked = [COLOR=blue]False[/COLOR]
 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadMenuItemOpenFile_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadMenuItemOpenFile.Click
        [COLOR=blue]If[/COLOR] [COLOR=blue]Me[/COLOR].RadRadioButtonMusic.IsChecked = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR]
            [COLOR=blue]Dim[/COLOR] myStream [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Stream[/COLOR] = [COLOR=blue]Nothing[/COLOR]
            [COLOR=blue]Dim[/COLOR] openFileDialog1 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]OpenFileDialog[/COLOR]()
            openFileDialog1.Multiselect = [COLOR=blue]True[/COLOR]
            openFileDialog1.InitialDirectory = [COLOR=#A31515]"C:\Users\Public\Music\Sample Music"[/COLOR]
            openFileDialog1.Filter = [COLOR=#A31515]"txt files (*.mp3;*.wav;*.wma)|*.mp3;*.wav;*.wma"[/COLOR]
            openFileDialog1.FilterIndex = 2
            openFileDialog1.RestoreDirectory = [COLOR=blue]True[/COLOR]
 
            [COLOR=blue]If[/COLOR] openFileDialog1.ShowDialog() = System.Windows.Forms.[COLOR=#2B91AF]DialogResult[/COLOR].OK [COLOR=blue]Then[/COLOR]
                [COLOR=blue]Try[/COLOR]
                    myStream = openFileDialog1.OpenFile()
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        [COLOR=green]' Insert code to read the stream here.[/COLOR]
                        [COLOR=blue]Dim[/COLOR] filepath() [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = openFileDialog1.FileNames
                        [COLOR=blue]Dim[/COLOR] ffile [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR]
                        [COLOR=blue]For[/COLOR] [COLOR=blue]Each[/COLOR] ffile [COLOR=blue]In[/COLOR] filepath
                            [COLOR=blue]Me[/COLOR].ListBoxFileName.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFileNameWithoutExtension(ffile))
                            [COLOR=blue]Me[/COLOR].ListBoxFilePath.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFullPath(ffile))
                        [COLOR=blue]Next[/COLOR]
 
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]Catch[/COLOR] Ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
                    [COLOR=#2B91AF]MessageBox[/COLOR].Show([COLOR=#A31515]"Cannot read file from disk. Original error: "[/COLOR] & Ex.Message)
                [COLOR=blue]Finally[/COLOR]
                    [COLOR=green]' Check this again, since we need to make sure we didn't throw an exception on open.[/COLOR]
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        myStream.Close()
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]Else[/COLOR]
            [COLOR=blue]Dim[/COLOR] myStream [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Stream[/COLOR] = [COLOR=blue]Nothing[/COLOR]
            [COLOR=blue]Dim[/COLOR] openFileDialog1 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]OpenFileDialog[/COLOR]()
            openFileDialog1.Multiselect = [COLOR=blue]True[/COLOR]
            openFileDialog1.InitialDirectory = [COLOR=#A31515]"C:\Users\Public\Video\Sample Video"[/COLOR]
            openFileDialog1.Filter = [COLOR=#A31515]"txt files (*.wmv;*.avi;*.mpg)|*.wmv;*.avi;*.mpg"[/COLOR]
            openFileDialog1.FilterIndex = 2
            openFileDialog1.RestoreDirectory = [COLOR=blue]True[/COLOR]
 
            [COLOR=blue]If[/COLOR] openFileDialog1.ShowDialog() = System.Windows.Forms.[COLOR=#2B91AF]DialogResult[/COLOR].OK [COLOR=blue]Then[/COLOR]
                [COLOR=blue]Try[/COLOR]
                    myStream = openFileDialog1.OpenFile()
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        [COLOR=green]' Insert code to read the stream here.[/COLOR]
                        [COLOR=blue]Dim[/COLOR] filepath() [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = openFileDialog1.FileNames
                        [COLOR=blue]Dim[/COLOR] ffile [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR]
                        [COLOR=blue]For[/COLOR] [COLOR=blue]Each[/COLOR] ffile [COLOR=blue]In[/COLOR] filepath
                            [COLOR=blue]Me[/COLOR].ListBoxFileName.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFileNameWithoutExtension(ffile))
                            [COLOR=blue]Me[/COLOR].ListBoxFilePath.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFullPath(ffile))
                        [COLOR=blue]Next[/COLOR]
 
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]Catch[/COLOR] Ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
                    [COLOR=#2B91AF]MessageBox[/COLOR].Show([COLOR=#A31515]"Cannot read file from disk. Original error: "[/COLOR] & Ex.Message)
                [COLOR=blue]Finally[/COLOR]
                    [COLOR=green]' Check this again, since we need to make sure we didn't throw an exception on open.[/COLOR]
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        myStream.Close()
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]If[/COLOR] ListBoxFileName.Items.Count > 0 [COLOR=blue]Then[/COLOR]
            RadPanelMediaSelect.Show()
            RadPanelSound.Show()
            RadMenuItemSaveList.Enabled = [COLOR=blue]True[/COLOR]
            RadPanelControls.Show()
            RadTrackBarVolumeSlider.Value = 30
            RadProgressBarVolume.Value1 = 30
            RadRadioButtonContinuous.IsChecked = [COLOR=blue]True[/COLOR]
            Mwmp.settings.volume = 30
            TimerUpdateInfo.Enabled = [COLOR=blue]True[/COLOR]
 
        [COLOR=blue]Else[/COLOR]
 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] ListBoxFileName_SelectedIndexChanged([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] ListBoxFileName.SelectedIndexChanged
        [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex = 0 [COLOR=blue]Then[/COLOR]
            RadButtonNext.Enabled = [COLOR=blue]True[/COLOR]
            RadButtonPrev.Enabled = [COLOR=blue]False[/COLOR]
        [COLOR=blue]ElseIf[/COLOR] ListBoxFileName.SelectedIndex = ListBoxFileName.Items.Count - 1 [COLOR=blue]Then[/COLOR]
            RadButtonNext.Enabled = [COLOR=blue]False[/COLOR]
            RadButtonPrev.Enabled = [COLOR=blue]True[/COLOR]
        [COLOR=blue]Else[/COLOR]
            RadButtonNext.Enabled = [COLOR=blue]True[/COLOR]
            RadButtonPrev.Enabled = [COLOR=blue]True[/COLOR]
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
        ListBoxFilePath.SelectedIndex = ListBoxFileName.SelectedIndex
        Mwmp.URL = ListBoxFilePath.SelectedItem
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadTrackBar_Scroll([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadTrackBarVolumeSlider.Scroll
 
        [COLOR=blue]Me[/COLOR].Mwmp.settings.volume = [COLOR=blue]Me[/COLOR].RadTrackBarVolumeSlider.Value
        RadProgressBarVolume.Value1 = RadTrackBarVolumeSlider.Value
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadMenuItemExit_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadMenuItemExit.Click
        [COLOR=blue]Me[/COLOR].Close()
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadMenuItemAbout_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadMenuItemAbout.Click
        [COLOR=#2B91AF]RadAboutBox1[/COLOR].Show()
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonRemoveAll_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonRemoveAll.Click
        ListBoxFileName.Items.Clear()
        ListBoxFilePath.Items.Clear()
        RadPanelMediaSelect.Hide()
        RadPanelSound.Hide()
        RadMenuItemSaveList.Enabled = [COLOR=blue]False[/COLOR]
        RadPanelControls.Hide()
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonRemoveOne_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonRemoveOne.Click
        [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex <> -1 [COLOR=blue]Then[/COLOR]
            ListBoxFileName.Items.RemoveAt(ListBoxFileName.SelectedIndex)
 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonSort_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonSort.Click
        ListBoxFileName.Sorted = [COLOR=blue]True[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPlay_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPlay.Click
        RadTrackBarSkip.Maximum = Mwmp.currentMedia.duration
        Mwmp.URL = ListBoxFilePath.SelectedItem
        TimerScan.Start()
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonNext_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonNext.Click
 
        [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex > ListBoxFileName.Items.Count - 1 [COLOR=blue]Then[/COLOR]
            ListBoxFileName.SelectedIndex = 0
        [COLOR=blue]Else[/COLOR]
            ListBoxFilePath.SelectedIndex = ListBoxFilePath.SelectedIndex + 1
            Mwmp.URL = ListBoxFilePath.SelectedItem
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPrev_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPrev.Click
        [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex < ListBoxFileName.Items.Count [COLOR=blue]Then[/COLOR]
            ListBoxFileName.SelectedIndex = 0
        [COLOR=blue]Else[/COLOR]
            ListBoxFilePath.SelectedIndex = ListBoxFilePath.SelectedIndex - 1
            Mwmp.URL = ListBoxFilePath.SelectedItem
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] mwmp_PlayStateChange([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] AxWMPLib.[COLOR=#2B91AF]_WMPOCXEvents_PlayStateChangeEvent[/COLOR]) [COLOR=blue]Handles[/COLOR] Mwmp.PlayStateChange
        [COLOR=blue]If[/COLOR] Mwmp.playState = [COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying [COLOR=blue]Then[/COLOR]
            RadTrackBarSkip.Maximum = Mwmp.Ctlcontrols.currentItem.duration
            TimerScan.Start()
 
        [COLOR=blue]ElseIf[/COLOR] Mwmp.playState = WMPLib.[COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPaused [COLOR=blue]Then[/COLOR]
 
            TimerScan.Stop()
 
        [COLOR=blue]ElseIf[/COLOR] Mwmp.playState = WMPLib.[COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsStopped [COLOR=blue]Then[/COLOR]
 
            TimerScan.Stop()
            RadTrackBarSkip.Value = 0
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
 
        [COLOR=green]'If Mwmp.playState = WMPLib.WMPPlayState.wmppsMediaEnded Then[/COLOR]
 
        [COLOR=green]'    If ListBoxFileName.SelectedIndex < ListBoxFileName.Items.Count - 1 Then[/COLOR]
        [COLOR=green]'        ListBoxFilePath.SelectedIndex = ListBoxFilePath.SelectedIndex + 1[/COLOR]
        [COLOR=green]'    Else[/COLOR]
 
        [COLOR=green]'        'Start at the top of the list again if needed[/COLOR]
 
        [COLOR=green]'        ListBoxFileName.SelectedIndex = 0[/COLOR]
 
        [COLOR=green]'    End If[/COLOR]
 
        [COLOR=green]'End If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadCheckBoxMute_ToggleStateChanged([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] args [COLOR=blue]As[/COLOR] Telerik.WinControls.UI.[COLOR=#2B91AF]StateChangedEventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadCheckBoxMute.ToggleStateChanged
        [COLOR=blue]If[/COLOR] Mwmp.settings.volume = Mwmp.settings.mute() [COLOR=blue]Then[/COLOR]
            Mwmp.settings.volume = 20
            RadTrackBarVolumeSlider.Value = 20
            RadProgressBarVolume.Value1 = 20
        [COLOR=blue]Else[/COLOR]
            Mwmp.settings.volume = Mwmp.settings.mute()
            RadTrackBarVolumeSlider.Value = 0
            RadProgressBarVolume.Value1 = 0
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
 
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPlay_MouseEnter([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPlay.MouseEnter
        RadButtonPlay.Image = [COLOR=blue]My[/COLOR].Resources.player_play1
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPlay_MouseLeave([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPlay.MouseLeave
        RadButtonPlay.Image = [COLOR=blue]My[/COLOR].Resources.player_play
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonNext_MouseEnter([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonNext.MouseEnter
        RadButtonNext.Image = [COLOR=blue]My[/COLOR].Resources.player_fwd1
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonNext_MouseLeave([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonNext.MouseLeave
        RadButtonNext.Image = [COLOR=blue]My[/COLOR].Resources.player_fwd
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPause_MouseEnter([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPause.MouseEnter
        RadButtonPause.Image = [COLOR=blue]My[/COLOR].Resources.player_pause1
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPause_MouseLeave([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPause.MouseLeave
        RadButtonPause.Image = [COLOR=blue]My[/COLOR].Resources.player_pause
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPrev_MouseEnter([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPrev.MouseEnter
        RadButtonPrev.Image = [COLOR=blue]My[/COLOR].Resources.player_back1
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPrev_MouseLeave([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPrev.MouseLeave
        RadButtonPrev.Image = [COLOR=blue]My[/COLOR].Resources.player_back
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonStop_MouseEnter([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonStop.MouseEnter
        RadButtonStop.Image = [COLOR=blue]My[/COLOR].Resources.player_stop1
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonStop_MouseLeave([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonStop.MouseLeave
        RadButtonStop.Image = [COLOR=blue]My[/COLOR].Resources.player_stop
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPause_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPause.Click
        [COLOR=blue]If[/COLOR] (Mwmp.playState = [COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying) [COLOR=blue]Then[/COLOR]
            Mwmp.Ctlcontrols.pause()
        [COLOR=blue]Else[/COLOR]
            Mwmp.Ctlcontrols.play()
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonStop_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonStop.Click
        Mwmp.Ctlcontrols.stop()
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
 
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] TmrUpdateInfo_Tick([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] TimerUpdateInfo.Tick
        [COLOR=blue]Try[/COLOR]
            [COLOR=blue]If[/COLOR] Mwmp.playState = WMPLib.[COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying [COLOR=blue]Then[/COLOR]
                RadLabelNowPlaying.Text = [COLOR=#A31515]"Now Playing:"[/COLOR] + Mwmp.currentMedia.name + [COLOR=#2B91AF]Environment[/COLOR].NewLine + [COLOR=#A31515]"Time:"[/COLOR] + Mwmp.Ctlcontrols.currentPositionString + [COLOR=#A31515]"/"[/COLOR] + Mwmp.currentMedia.durationString
 
            [COLOR=blue]Else[/COLOR]
                RadTrackBarSkip.Value = 0
                RadLabelNowPlaying.Text = [COLOR=#A31515]"Not Playing"[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]Catch[/COLOR] ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
            MsgBox([COLOR=#A31515]"An Error Occurred!"[/COLOR] + [COLOR=#2B91AF]Environment[/COLOR].NewLine + ex.Message.ToString, [COLOR=#2B91AF]MsgBoxStyle[/COLOR].Critical + [COLOR=#2B91AF]MsgBoxStyle[/COLOR].MsgBoxSetForeground)
        [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
 
    
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadTrackBarSkip_Scroll([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.Windows.Forms.[COLOR=#2B91AF]ScrollEventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadTrackBarSkip.Scroll
        [COLOR=blue]Try[/COLOR]
            [COLOR=blue]If[/COLOR] (Mwmp.currentMedia.duration <> 0) [COLOR=blue]Then[/COLOR]
                [COLOR=blue]Dim[/COLOR] NewPerc [COLOR=blue]As[/COLOR] [COLOR=blue]Double[/COLOR] = [COLOR=#2B91AF]Convert[/COLOR].ToDouble(RadTrackBarSkip.Value) / 100
                [COLOR=blue]Dim[/COLOR] DurationVar [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR] =
                [COLOR=#2B91AF]Convert[/COLOR].ToInt32(Mwmp.currentMedia.duration * 1000) [COLOR=green]'milliseconds[/COLOR]
                [COLOR=blue]Dim[/COLOR] NewPos [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR] = (DurationVar * NewPerc) / 1000
                Mwmp.Ctlcontrols.currentPosition = NewPos
            [COLOR=blue]Else[/COLOR]
                [COLOR=green]'RadTrackBarSkip.Value = 0[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]Catch[/COLOR] ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
            MsgBox(ex.Message)
        [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
    [COLOR=blue]Dim[/COLOR] IsShuffle [COLOR=blue]As[/COLOR] [COLOR=blue]Boolean[/COLOR]
 
 
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadRadioButtonContinuous_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadRadioButtonContinuous.Click
        [COLOR=blue]If[/COLOR] RadRadioButtonContinuous.IsChecked = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR]
            RadRadioButtonShuffle.IsChecked = [COLOR=blue]False[/COLOR]
            IsShuffle = [COLOR=blue]False[/COLOR]
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]If[/COLOR] Mwmp.playState = [COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying [COLOR=blue]Then[/COLOR]
        [COLOR=blue]Else[/COLOR]
            [COLOR=blue]If[/COLOR] IsShuffle [COLOR=blue]Then[/COLOR]
                [COLOR=green]' in case shuffle is on use the random code given before[/COLOR]
                [COLOR=blue]Dim[/COLOR] rand [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]Random[/COLOR]()
                ListBoxFileName.SelectedIndex = rand.[Next](0, ListBoxFileName.Items.Count - 1)
            [COLOR=blue]Else[/COLOR]
                [COLOR=green]' its continuous play so play next song[/COLOR]
                [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex + 1 <= ListBoxFileName.Items.Count - 1 [COLOR=blue]Then[/COLOR]
 
                    [COLOR=green]' it means we are not playing the last song in the list so you can tell it to move to the next one[/COLOR]
                    ListBoxFileName.SelectedIndex = ListBoxFileName.SelectedIndex + 1
 
                [COLOR=blue]Else[/COLOR]
                    [COLOR=green]' it's the last song in the list so either move to index 0 from here or stop the music completely[/COLOR]
                    ListBoxFileName.SelectedIndex = 0
 
                [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
 
        [COLOR=green]' now when you're done deciding which song needs to be selected set the URL to currently selected item[/COLOR]
        Mwmp.URL = ListBoxFilePath.SelectedItem
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadRadioButtonShuffle_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadRadioButtonShuffle.Click
        [COLOR=blue]If[/COLOR] RadRadioButtonShuffle.IsChecked = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR]
            RadRadioButtonContinuous.IsChecked = [COLOR=blue]False[/COLOR]
            IsShuffle = [COLOR=blue]True[/COLOR]
            [COLOR=blue]If[/COLOR] Mwmp.playState = [COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying [COLOR=blue]Then[/COLOR]
            [COLOR=blue]Else[/COLOR]
                [COLOR=blue]If[/COLOR] IsShuffle [COLOR=blue]Then[/COLOR]
                    [COLOR=green]' in case shuffle is on use the random code given before[/COLOR]
                    [COLOR=blue]Dim[/COLOR] rand [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]Random[/COLOR]()
                    ListBoxFileName.SelectedIndex = rand.[Next](0, ListBoxFileName.Items.Count - 1)
                [COLOR=blue]Else[/COLOR]
                    [COLOR=green]' its continuous play so play next song[/COLOR]
                    [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex + 1 <= ListBoxFileName.Items.Count - 1 [COLOR=blue]Then[/COLOR]
 
                        [COLOR=green]' it means we are not playing the last song in the list so you can tell it to move to the next one[/COLOR]
                        ListBoxFileName.SelectedIndex = ListBoxFileName.SelectedIndex + 1
 
                    [COLOR=blue]Else[/COLOR]
                        [COLOR=green]' it's the last song in the list so either move to index 0 from here or stop the music completely[/COLOR]
                        ListBoxFileName.SelectedIndex = 0
 
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
 
            [COLOR=green]' now when you're done deciding which song needs to be selected set the URL to currently selected item[/COLOR]
            Mwmp.URL = ListBoxFilePath.SelectedItem
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] TimerScan_Tick([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] TimerScan.Tick
        [COLOR=blue]If[/COLOR] Mwmp.playState = WMPLib.[COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying [COLOR=blue]Then[/COLOR]
            RadTrackBarSkip.Value = Mwmp.Ctlcontrols.currentPosition
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
   
[COLOR=blue]End[/COLOR] [COLOR=blue]Class[/COLOR]
I am having trouble with the slider control here:

VB.NET:
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadTrackBarSkip_Scroll([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.Windows.Forms.[COLOR=#2B91AF]ScrollEventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadTrackBarSkip.Scroll
        [COLOR=blue]Try[/COLOR]
            [COLOR=blue]If[/COLOR] (Mwmp.currentMedia.duration <> 0) [COLOR=blue]Then[/COLOR]
                [COLOR=blue]Dim[/COLOR] NewPerc [COLOR=blue]As[/COLOR] [COLOR=blue]Double[/COLOR] = [COLOR=#2B91AF]Convert[/COLOR].ToDouble(RadTrackBarSkip.Value) / 100
                [COLOR=blue]Dim[/COLOR] DurationVar [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR] =
                [COLOR=#2B91AF]Convert[/COLOR].ToInt32(Mwmp.currentMedia.duration * 1000) [COLOR=green]'milliseconds[/COLOR]
                [COLOR=blue]Dim[/COLOR] NewPos [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR] = (DurationVar * NewPerc) / 1000
                Mwmp.Ctlcontrols.currentPosition = NewPos
            [COLOR=blue]Else[/COLOR]
                [COLOR=green]'RadTrackBarSkip.Value = 0[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]Catch[/COLOR] ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
            MsgBox(ex.Message)
        [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
When I move the slider past the half way mark it seems to jump to the end and the player stops I have tried changing the values but that did not work, I am using a timer that moves the slider while a track is playing

VB.NET:
[COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] TimerScan_Tick([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] TimerScan.Tick
        [COLOR=blue]If[/COLOR] Mwmp.playState = WMPLib.[COLOR=#2B91AF]WMPPlayState[/COLOR].wmppsPlaying [COLOR=blue]Then[/COLOR]
            RadTrackBarSkip.Value = Mwmp.Ctlcontrols.currentPosition
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
Could this be affecting the result?

The other problem I can't seem to get my head around is the prev and next track buttons

VB.NET:
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonNext_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonNext.Click
 
        [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex > ListBoxFileName.Items.Count - 1 [COLOR=blue]Then[/COLOR]
            ListBoxFileName.SelectedIndex = 0
        [COLOR=blue]Else[/COLOR]
            ListBoxFilePath.SelectedIndex = ListBoxFilePath.SelectedIndex + 1
            Mwmp.URL = ListBoxFilePath.SelectedItem
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
 
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadButtonPrev_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadButtonPrev.Click
        [COLOR=blue]If[/COLOR] ListBoxFileName.SelectedIndex < ListBoxFileName.Items.Count [COLOR=blue]Then[/COLOR]
            ListBoxFileName.SelectedIndex = 0
        [COLOR=blue]Else[/COLOR]
            ListBoxFilePath.SelectedIndex = ListBoxFilePath.SelectedIndex - 1
            Mwmp.URL = ListBoxFilePath.SelectedItem
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
 
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
It will skip to the next track but when it gets the end of the list it throws and exeption error

Can anyone point me in the right direction :)

thanks

Mike
 

mikejs

New member
Joined
Mar 5, 2011
Messages
2
Programming Experience
1-3
Hi Ok so I now have my next and previous buttons working I am hoping someone can help me with the next isue currently if I click open > browse for some media files > select media it populates the listbox and sets the trackbar to maximum value using the following code

VB.NET:
    [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadMenuItemOpen_Click_1([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadMenuItemOpen.Click
        [COLOR=blue]If[/COLOR] [COLOR=blue]Me[/COLOR].RadRadioButtonMusic.IsChecked = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR]
            [COLOR=blue]Dim[/COLOR] myStream [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Stream[/COLOR] = [COLOR=blue]Nothing[/COLOR]
            [COLOR=blue]Dim[/COLOR] openFileDialog1 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]OpenFileDialog[/COLOR]()
            openFileDialog1.Multiselect = [COLOR=blue]True[/COLOR]
            openFileDialog1.InitialDirectory = [COLOR=#A31515]"M:\Mp3"[/COLOR]
            openFileDialog1.Filter = [COLOR=#A31515]"txt files (*.mp3;*.wav;*.wma)|*.mp3;*.wav;*.wma"[/COLOR]
            openFileDialog1.FilterIndex = 2
            openFileDialog1.RestoreDirectory = [COLOR=blue]True[/COLOR]
 
            [COLOR=blue]If[/COLOR] openFileDialog1.ShowDialog() = System.Windows.Forms.[COLOR=#2B91AF]DialogResult[/COLOR].OK [COLOR=blue]Then[/COLOR]
                [COLOR=blue]Try[/COLOR]
                    myStream = openFileDialog1.OpenFile()
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        [COLOR=green]' Insert code to read the stream here.[/COLOR]
                        [COLOR=blue]Dim[/COLOR] filepath() [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = openFileDialog1.FileNames
                        [COLOR=blue]Dim[/COLOR] ffile [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR]
                        [COLOR=blue]For[/COLOR] [COLOR=blue]Each[/COLOR] ffile [COLOR=blue]In[/COLOR] filepath
                            [COLOR=blue]Me[/COLOR].ListBoxFileName.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFileNameWithoutExtension(ffile))
                            [COLOR=blue]Me[/COLOR].ListBoxFilePath.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFullPath(ffile))
                        [COLOR=blue]Next[/COLOR]
 
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]Catch[/COLOR] Ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
                    [COLOR=#2B91AF]MessageBox[/COLOR].Show([COLOR=#A31515]"Cannot read file from disk. Original error: "[/COLOR] & Ex.Message)
                [COLOR=blue]Finally[/COLOR]
                    [COLOR=green]' Check this again, since we need to make sure we didn't throw an exception on open.[/COLOR]
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        myStream.Close()
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]Else[/COLOR]
            [COLOR=blue]Dim[/COLOR] myStream [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Stream[/COLOR] = [COLOR=blue]Nothing[/COLOR]
            [COLOR=blue]Dim[/COLOR] openFileDialog2 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]OpenFileDialog[/COLOR]()
            openFileDialog2.Multiselect = [COLOR=blue]True[/COLOR]
            openFileDialog2.InitialDirectory = [COLOR=#A31515]"C:\Users\Public\Videos\Sample Videos"[/COLOR]
            openFileDialog2.Filter = [COLOR=#A31515]"txt files (*.wmv;*.avi;*.mpg)|*.wmv;*.avi;*.mpg"[/COLOR]
            openFileDialog2.FilterIndex = 2
            openFileDialog2.RestoreDirectory = [COLOR=blue]True[/COLOR]
 
            [COLOR=blue]If[/COLOR] openFileDialog2.ShowDialog() = System.Windows.Forms.[COLOR=#2B91AF]DialogResult[/COLOR].OK [COLOR=blue]Then[/COLOR]
                [COLOR=blue]Try[/COLOR]
                    myStream = openFileDialog2.OpenFile()
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        [COLOR=green]' Insert code to read the stream here.[/COLOR]
                        [COLOR=blue]Dim[/COLOR] filepath() [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = openFileDialog2.FileNames
                        [COLOR=blue]Dim[/COLOR] ffile [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR]
                        [COLOR=blue]For[/COLOR] [COLOR=blue]Each[/COLOR] ffile [COLOR=blue]In[/COLOR] filepath
                            [COLOR=blue]Me[/COLOR].ListBoxFileName.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFileNameWithoutExtension(ffile))
                            [COLOR=blue]Me[/COLOR].ListBoxFilePath.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFullPath(ffile))
                        [COLOR=blue]Next[/COLOR]
 
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]Catch[/COLOR] Ex [COLOR=blue]As[/COLOR] [COLOR=#2B91AF]Exception[/COLOR]
                    [COLOR=#2B91AF]MessageBox[/COLOR].Show([COLOR=#A31515]"Cannot read file from disk. Original error: "[/COLOR] & Ex.Message)
                [COLOR=blue]Finally[/COLOR]
                    [COLOR=green]' Check this again, since we need to make sure we didn't throw an exception on open.[/COLOR]
                    [COLOR=blue]If[/COLOR] (myStream [COLOR=blue]IsNot[/COLOR] [COLOR=blue]Nothing[/COLOR]) [COLOR=blue]Then[/COLOR]
                        myStream.Close()
                    [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
                [COLOR=blue]End[/COLOR] [COLOR=blue]Try[/COLOR]
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
        [COLOR=blue]If[/COLOR] ListBoxFileName.Items.Count > 0 [COLOR=blue]Then[/COLOR]
            RadPanelMediaSelect.Show()
            RadPanelSound.Show()
            RadMenuItemSave.Enabled = [COLOR=blue]True[/COLOR]
            RadPanelControls.Enabled = [COLOR=blue]True[/COLOR]
            RadTrackBarVolumeSlider.Value = 30
            RadProgressBarVolume.Value1 = 30
            Mwmp.settings.volume = 30
            ListBoxFileName.SelectedIndex = 0
            Mwmp.URL = ListBoxFilePath.SelectedItem
            RadTrackBarSkip.Maximum = Mwmp.currentMedia.duration
 
            TimerScan.Start()
            TimerUpdateInfo.Start()
        [COLOR=blue]Else[/COLOR]
 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]

However if I use the scan files button to search folders for media files it populates the listbox but for some reason the trackbar does not display correctly nor does it move in sync as it does with the file open method above

This is my code for scan files

VB.NET:
 [COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] RadMenuItemScan_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.[COLOR=#2B91AF]EventArgs[/COLOR]) [COLOR=blue]Handles[/COLOR] RadMenuItemScan.Click
        files = FileIO.[COLOR=#2B91AF]FileSystem[/COLOR].GetFiles([COLOR=blue]My[/COLOR].Computer.FileSystem.SpecialDirectories.MyPictures, FileIO.[COLOR=#2B91AF]SearchOption[/COLOR].SearchAllSubDirectories, [COLOR=#A31515]"*.mp3"[/COLOR])
        files = FileIO.[COLOR=#2B91AF]FileSystem[/COLOR].GetFiles([COLOR=blue]My[/COLOR].Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData, FileIO.[COLOR=#2B91AF]SearchOption[/COLOR].SearchAllSubDirectories, [COLOR=#A31515]"*.mp3"[/COLOR])
        files = FileIO.[COLOR=#2B91AF]FileSystem[/COLOR].GetFiles([COLOR=blue]My[/COLOR].Computer.FileSystem.SpecialDirectories.MyMusic, FileIO.[COLOR=#2B91AF]SearchOption[/COLOR].SearchAllSubDirectories, [COLOR=#A31515]"*.mp3"[/COLOR], [COLOR=#A31515]"*.wav"[/COLOR], [COLOR=#A31515]"*.mp4"[/COLOR], [COLOR=#A31515]"*.avi"[/COLOR], [COLOR=#A31515]"*.MPEG"[/COLOR])
        files = FileIO.[COLOR=#2B91AF]FileSystem[/COLOR].GetFiles([COLOR=blue]My[/COLOR].Computer.FileSystem.SpecialDirectories.Desktop, FileIO.[COLOR=#2B91AF]SearchOption[/COLOR].SearchAllSubDirectories, [COLOR=#A31515]"*.mp3"[/COLOR])
        [COLOR=blue]For[/COLOR] [COLOR=blue]Each[/COLOR] ffile [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] [COLOR=blue]In[/COLOR] files
            [COLOR=blue]Me[/COLOR].ListBoxFilePath.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFullPath(ffile))
            [COLOR=blue]Me[/COLOR].ListBoxFileName.Items.Add(System.IO.[COLOR=#2B91AF]Path[/COLOR].GetFileNameWithoutExtension(ffile))
        [COLOR=blue]Next[/COLOR]
        [COLOR=blue]If[/COLOR] ListBoxFileName.Items.Count > 0 [COLOR=blue]Then[/COLOR]
 
            RadPanelMediaSelect.Show()
            RadPanelSound.Show()
            RadMenuItemSave.Enabled = [COLOR=blue]True[/COLOR]
            RadPanelControls.Enabled = [COLOR=blue]True[/COLOR]
            RadTrackBarVolumeSlider.Value = 30
            RadProgressBarVolume.Value1 = 30
            Mwmp.settings.volume = 30
            ListBoxFileName.SelectedIndex = 0
            Mwmp.URL = ListBoxFilePath.SelectedItem
            RadTrackBarSkip.Maximum = Mwmp.currentMedia.duration
 
            TimerScan.Start()
            TimerUpdateInfo.Start()
 
            RadDesktopAlert1.Show()
            [COLOR=blue]Dim[/COLOR] d [COLOR=blue]As[/COLOR] [COLOR=blue]Double[/COLOR] = files.Count
            [COLOR=blue]Dim[/COLOR] number [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = d.ToString
            RadDesktopAlert1.CaptionText = [COLOR=#A31515]"Scan Complete"[/COLOR] + [COLOR=#2B91AF]Environment[/COLOR].NewLine + [COLOR=#A31515]"Found:"[/COLOR] + number + [COLOR=#A31515]"Files"[/COLOR]
 
 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
    [COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
Does anyone know why the trackbar is not displaying or updating as it should ?

thanks

M
 
Top Bottom