Other Software > Developer's Corner
Taking an item from a listbox and casting it to a WMP control? (.NET)
(1/1)
wreckedcarzz:
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: vb.net ---Private Sub ListView1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick 'Playlist = Player.newPlaylist("myPlayList", "") 'Player.currentPlaylist = ListView1.SelectedIndices 'InfoLabel.Visible = False Dim Playlist As IWMPPlaylist = ListView1.SelectedItems.ToString 'Dim theMedia = libForm.TheMedia Playlist = Player.currentPlaylist ' Set the current media. It will play automatically. Player.currentMedia = Playlist 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
-Brandon
Navigation
[0] Message Index
Go to full version