0

Hello There,

Im trying to create tree control view with check box in the nods.
but i dont know how to add the check box to the nods

here is the code:

public Form1()
{
InitializeComponent();
TreeNode tn = new TreeNode("x");
tn.ForeColor = Color.Blue;
TreeNode tn1 = new TreeNode("Y");
tn1.ForeColor = Color.Blue;
TreeNode tn2 = new TreeNode("T");
tn2.ForeColor = Color.Blue;
treeView1.Nodes.Add(tn);
treeView1.Nodes.Add(tn1);
treeView1.Nodes.Add(tn2);

treeView1.LabelEdit = true;

}

How can i add the check boxes to the nods X,Y,T

Thanks ahead

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by coder_guru
1

First of all it is Node not Nod.

the only way to add check boxes to the node tree is by specifying it on the TreeView object itself, thus all of the nodes will have checkboxes.

but in your example it would be

treeView1.CheckBoxes = true;

another method (if you are seeking to only have it on a few and not the entire tree) is to use an image list and keep track of which nodes are visually marked with your custom check or not.

Votes + Comments
good
0

any idea how to add checkbox to treeview in smartphone since it does not support checkboxes in the treeview by default

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.