Creating a Media Playlist using Widows Media Player in VB.NET

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. output 3. Now, check the Windows Media Player in the COM components. output 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: output 5. Then, let's code! We will code for the button to open some files and be put on the LitBox.
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. OpenFileDialog1.ShowDialog()
  3. If Windows.Forms.DialogResult.OK Then
  4. For Each track As String In OpenFileDialog1.FileNames
  5. ListBox1.Items.Add(track)
  6. Next
  7. End If
Then, after putting the files on the ListBox, put this code below for playing the selected music or videos in the ListBox.
  1. Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
  2. AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
  3. End Sub

Output:

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

Comments

Submitted byPeter E. (not verified)on Mon, 10/03/2016 - 16:20

Thank you very much for this code! It works great. Do you know how we can send a song to an external connected device like a Radio? I mean like the "Play To" function on a right mouse click for a song?

Add new comment