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:
public void PopulateTreeView(string directoryValue, TreeNode parentNode)
{
try
{
DirectoryInfo directory = new DirectoryInfo(directoryValue);
foreach (DirectoryInfo d in directory.GetDirectories())
{
// Create Node
TreeNode t = new TreeNode(d.Name);
PopulateTreeView(d.FullName, t);
parentNode.Nodes.Add(t);
}
foreach (FileInfo f in directory.GetFiles("*.mp3"))
{
TreeNode t = new TreeNode();
t.Text = f.Name.ToString();
t.Tag = Path.GetFullPath(f.DirectoryName);
parentNode.Nodes.Add(t);
}
}
catch (UnauthorizedAccessException)
{
parentNode.Nodes.Add("Access denied");
}
}
|
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 :