Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Treeview Question 1

Status
Not open for further replies.

VBXL

Programmer
Jul 10, 2001
198
GB
Hi,

How do i do the following in a C# within a Treeview
in C# code?

Root
Parent1
Child1
Child2
Parent2
Child1
Child3

Cheers
VBXL


VBXL

- .Net SQL Server
chat.slickcity.co.uk - Chat about .Net
search.slickcity.co.uk - Web Services
message.slickcity.co.uk - Tech help for SlickCity
 
For example:
Code:
TreeNode root = new TreeNode("Root");
tv.Nodes.Add(root);

TreeNode parent = new TreeNode("Parent1");
root.Nodes.Add(parent);

parent.Nodes.Add(new TreeNode("Child1"));
parent.Nodes.Add(new TreeNode("Child2"));

parent = new TreeNode("Parent2");
root.Nodes.Add(parent);

parent.Nodes.Add(new TreeNode("Child1"));
parent.Nodes.Add(new TreeNode("Child3"));
 
Thanks

VBXL

VBXL

- .Net SQL Server
chat.slickcity.co.uk - Chat about .Net
search.slickcity.co.uk - Web Services
message.slickcity.co.uk - Tech help for SlickCity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top