Private Sub AddMusicToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddMusicToolStripMenuItem.Click
On Error Resume Next
Dim Multi() As String
Dim FEn As IEnumerator
Dim str(2) As String
Dim itm As ListViewItem
Dim path, Name As String
Dim OpenDialog As New OpenFileDialog
OpenDialog.Filter = "Supported Media (avi, mid, mp3, mpg, mpeg, mp4, wav, wma, wmv)|*.avi;*.mid;*.mp3; *.mpg; *.mpeg;*.mp4;*.wav;*.wma;*.wmv|Audio Media (*.mid, *.mp3, *.wav, *.wma|*.mid;*.mp3;*.wav;*.wma|Video Media (*.avi, *.mpg, *.mpeg, *.wmv)|*.avi;*.mpg;*.mpeg;*.wmv"
OpenDialog.Multiselect = True
If OpenDialog.ShowDialog = Windows.Forms.DialogResult.OK Then Multi = OpenDialog.FileNames
If IsNothing(Multi) Then Exit Sub
FEn = Multi.GetEnumerator
FEn.Reset()
While FEn.MoveNext
str(1) = (CType(FEn.Current, String))
path = (CType(FEn.Current, String))
Dim x As Integer = path.LastIndexOf("\") + 1
Dim mediaName As String = path.Substring(x)
x = mediaName.LastIndexOf(".")
mediaName = mediaName.Substring(0, x)
Name = mediaName
x = Nothing
mediaName = Nothing
str(0) = Name
itm = New ListViewItem(str)
ListView1.Visible = False
ListView1.Items.Add(itm)
ListView1.Visible = True
End While
End Sub
I would like to be able to make code to, once i select the a file in the listbox via mouse click (the code for this is below), after the file finishes playing the next file starts playing until the end of the list.
listview1.Items(0).Selected = True listview1.Select()
I tried to do something like:
if (AxWindowsMediaPlayer1.playState = 1) then listview1.Items(0).Selected = False if (AxWindowsMediaPlayer1.playState = 1) then listview1.Items(1).Selected = True listview1.select() AxWindowsMediaPlayer1.URL = (ListView1.SelectedItems(0).SubItems(1).Text)
that will, if the media player is stopped, select the 'second' item in the listview and then play it... that is bound to the second item though and I made many timers and such to try and get this method to work but nothing so far works..
This post has been edited by JohnorSky: 01 September 2009 - 03:25 AM

New Topic/Question
Reply




MultiQuote




|