Help In Treeview

usman.pak

New member
Joined
Mar 18, 2007
Messages
4
Programming Experience
Beginner
i Want to add the tree view parents node and child nodes dynamicaly mean i want to do in this way

i have two textbox one for parent node and other for child node , and two buttons one for child and other for parent.

i want to do that when you enter the name in txtbox parent and click btnparent then it create a node according to the name in text box

after that i select any parrent node in tree view and put valuen in txtchildnode and click the btnchild then it adds the child node to it how i can do that.

Please help me .
 
The first you mean adding root nodes?
VB.NET:
Expand Collapse Copy
treeview1.Nodes.Add(newnode)
With a node selected you can use the SelectedNode property:
VB.NET:
Expand Collapse Copy
treeview1.SelectedNode.Nodes.Add(newnode)
(If no TreeNode is currently selected, the SelectedNode property is a null reference (Nothing in Visual Basic))
 
Back
Top