avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • January 16, 2019, 09:51 AM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Taking an item from a listbox and casting it to a WMP control? (.NET)  (Read 2488 times)


  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,626
    • View Profile
    • Donate to Member
OK, this one has been driving me up the wall for a while now.

I have a WMP control and a listview. Simple enough.

What I am trying to do is allow the user to double-click an item in the listview, and add it to a playlist (begin playing it in the WMP control). I have tried numerous ways to do this, and all of them give an error saying that it cannot cast the type String to WMPlayer (or whatever the name of the WMP control backend is called).

Avoiding sounding like a total idiot, here is the current code that I have (that is still a total FAIL)

Code: [Select]
  1. Private Sub ListView1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
  2.         'Playlist = Player.newPlaylist("myPlayList", "")
  3.         'Player.currentPlaylist = ListView1.SelectedIndices
  4.         'InfoLabel.Visible = False
  6.         Dim Playlist As IWMPPlaylist = ListView1.SelectedItems.ToString
  7.         'Dim theMedia = libForm.TheMedia
  8.         Playlist = Player.currentPlaylist
  10.         ' Set the current media. It will play automatically.
  11.         Player.currentMedia = Playlist
  13.     End Sub

Anyone got a tutorial on this? Ideas? Am I a total oblivious idiot and am missing one line of code??? :tellme: H-E-L-P! ;D