This tutorial will teach you on how to create a music playlist using windows media player in vb.net.
So now I will be going to teach you how to do this.
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to
File, click
New Project, and choose
Windows Application.
2. Right click the ToolBox, and click the Choose Items.

3. Now, check the Windows Media Player in the COM components.

4. Next, add the
WindowsMediaPlayer component to the Form and insert a button named
Button1 to add song to the ListBox. Add also a LisBox named
ListBox1 to view all the songs and an
OpenFileDialog for the button. You must design your interface like this:

5. Then, let's code!
We will code for the button to open some files and be put on the LitBox.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
If Windows.Forms.DialogResult.OK Then
For Each track As String In OpenFileDialog1.FileNames
ListBox1.Items.Add(track)
Next
End If
Then, after putting the files on the ListBox, put this code below for playing the selected music or videos in the ListBox.
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
End Sub
Output:

Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:
[email protected]
Add and Follow me on Facebook:
https://www.facebook.com/donzzsky
Visit and like my page on Facebook at:
https://www.facebook.com/BermzISware