Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

How do you read the artist info and other data from a music file?

I am trying to create a playlist using windows media player component. I have code that will open up a song and play it, I now want to see what is playing. What is the best way to do this?
//This code loads a song. I want to display the songs title and artist info in a text box. 
 
  Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
        dlgOpen.InitialDirectory = My.Computer.FileSystem.CurrentDirectory
        dlgOpen.ShowDialog()
        Player.URL = dlgOpen.FileName
 
   End Sub

Open in new window

0
jhmblvd
Asked:
jhmblvd
  • 2
  • 2
1 Solution
 
jpaulinoCommented:
You can add a label bellow the player and show that!
0
 
jhmblvdAuthor Commented:
I tried this:

  Me.txtArtist.Text = dlgOpen.FileName.Trim

But it gives me the whole path to the file including the name of the song.
0
 
jpaulinoCommented:
And this way it's ok for you ?
Me.txtArtist.Text = IO.Path.GetFileNameWithoutExtension(dlgOpen.FileName.Trim)

Open in new window

0
 
jhmblvdAuthor Commented:
Thanks ipaulino! Works great
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now