|
-
Jan 4th, 2014, 03:05 PM
#1
Thread Starter
Member
Get Child Node Name
Hi,
Is there any code that can display the name of a child node in say a Message box on an AfterSelect or click event?
The nodes that i have are basically folder name's and i just need to be able to reference the folder name and not the path.
Thanks
-
Jan 4th, 2014, 04:18 PM
#2
Re: Get Child Node Name
We're assuming this is what? A standard Treeview control? And we're getting the name of the node selected? Or a child of the selected node? Or the termination point of the branch ... or ....?
Assuming the simplest scenario ...
vb.net Code:
Private Sub TreeView1_AfterSelect(sender As System.Object, e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Me.Text = e.Node.Name
End Sub
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Jan 5th, 2014, 03:16 AM
#3
Thread Starter
Member
Re: Get Child Node Name
Sorry 1 Parent Node with multiple child nodes that are folder names within 1 directory.
I actually have a listbox that, when the child node is selected, a SQL query is executed and some file names appear. The query has a criteria that is part of the file name displayed in the child node.
Essentially what should be happening is that the file in the listbox, once double clicked, will copy into the folder of the selected Child node.
The copying of the file I'm all fine with its just I'm struggling to reference the child node from the listbox.
The reason I asked for it in a message box was simply to see what the syntax may be.
Thanks
Last edited by MarkGB; Jan 5th, 2014 at 03:18 AM.
Reason: Typo
-
Jan 5th, 2014, 11:44 AM
#4
Re: Get Child Node Name
Presumably the node will still be selected when this is required so something like ....
vb.net Code:
Private Sub ListBox1_DoubleClick(sender As System.Object, e As System.EventArgs) Handles ListBox1.DoubleClick
Me.Text = IO.Path.Combine(TreeView1.SelectedNode.Parent.Name, TreeView1.SelectedNode.Name, ListBox1.SelectedItem.ToString)
End Sub
?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Jan 5th, 2014, 12:41 PM
#5
Thread Starter
Member
Re: Get Child Node Name
Need to try it but that looks just what I'm looking for. Thanks so much
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|