Select childnodes of a checked node on treeview ?

G

Guest

Hello !!!

I have a treeview with checkbox to select element.
The problem is that i can't found how to automatically select the childnodes
the checked node.
Someone know how to do that ?
Thanks.
 
R

Robbe Morris [C# MVP]

Recursion...

private void SetMyChildren(TreeNode parentNode,bool isChecked)
{

parentNode.Checked = isChecked;

for(int i=0;i<parentNode.Nodes.Count;i++)
{
SetMyChildren(parentNode.Nodes,isChecked);
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top