First timer here and a complete newbie heh..
I' jumped right in and are trying to learn C#, and i'v bin struggling whit a TreeView / ListBox solution the last couple of days and now i have to aske..
This is how i Populate the Treeview:
This is how i Populate the Treeview:
C# |
it's looking in a fixed directory (whit sub folders) for mp3 files.. this works.
now the big question from here..
I got a ListBox that has to become the playlist, sow i got button to add a selected TreeView Node over to ListBox
as you can see above i have a t.Text and a t.Tag, t.text holde the file name and t.Tag the FullPath
how do i get Text and FullPath into my ListBox as a Item ? i hav tryed DisplayMember and ValueMember :
Code |
Code
lbPlaylist is the ListBoxCode
can anyone of you help here ?Code
is ther i a better way ?Code
and please.. remember im a complete newbie :)
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Apr 9, 2010, 3:16 AM EDT
Hello John
you can also used ListView control instead of listbox
Add listview and set it's property 'View' to list
and use this code:
ListViewItem lstitem = new ListViewItem();
lstitem.Text = tvMedia.SelectedNode.Text;
lstitem.Tag = tvMedia.SelectedNode.Tag;
listView1.Items.Add(lstitem);
thanks
Please mark as answere if it helps
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Apr 8, 2010, 11:18 PM EDT
you can use item.add property of listboxforadding treeview node text or tag like this:
lbPlaylist .Items.Add(tvMedia.SelectedNode.Text)
lbPlaylist .Items.Add(tvMedia.SelectedNode.Tag)
thanks
Please mark as answere if it helps
John5 reputationPosted Apr 9, 2010, 12:09 AM EDT
sow that t.Text will be shown in the ListBox and t.Tag (the fullpath to the file) to send to
the player part on selected (in ListBox)..