kiranreddys.com
Kiran's personal website
Blog    Forums   Sitemap   Social    Phone
 
     

 
Knowledgebase
 
Home
Knowledge base home, and site home.
Categories
List of all Knowledge base categories.
Glossary
An alphabetical list of technical terms.
Contact Me
Contact me for knowledge base questions
My Blog
My articles, white papers, ideas and thoughts.
 

 
 


Populating tree nodes of a Tree view control in C#.NET

Date Added January 1, 1970 | Print | Bookmark
//How can I populate tree nodes of a Tree View Control in C#.NET?

//Code by Kiran Reddy
//TreeViewNodes
//First add one parent node to the Tree View control in its properties, select the parent node, to add child nodes to the Tree view add following code to button click events

TreeNode tvnode = new TreeNode("your_Node_Name");
treeView1.SelectedNode.Nodes.Add(tvnode);
treeView1.ExpandAll();
if(treeView1.SelectedNode.Nodes.Count > 1 && treeView1.SelectedNode.ForeColor != Color.Blue)
treeView1.SelectedNode.ForeColor = Color.Green;

//Add siblings to treeview

TreeNode tvnode = new TreeNode("your_Node_Name");
tvnode.ForeColor = Color.Brown;
treeView1.SelectedNode.Parent.Nodes.Add(tvnode);

//Delete selected node
treeView1.SelectedNode.Remove();

Was this article helpful?

Yes No

Category: C#.NET - Windows

Last updated on January 1, 1970 with 8336 views

0 User Comments

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

CAPTCHA Image
Security code

 



Home | About Me | Products | Support | Contact | Knowledgebase | Forums | Blog | Site map | Site Search | Subscribe | Links | Social | News

Travel | Guest Book | All Pages | History | Site Calendar | Recipes | Ex-Rates | UK Stuff | Downloads | Telugu Stuff | Tell a Friend | Feedback

Bookmark and Share
www.kiranreddys.com
Terms of Use
Site contents Copyright © 2008-2009 Kiran Reddy. All rights reserved.