Ken H

Ken H

  • NA
  • 646
  • 360.9k

How to remove checked nodes in c# treeview?

Dec 11 2014 4:59 AM
Hi all,
 
My codes:
 
private void btnRemove_Click(object sender, EventArgs e)
{
     RemoveCheckedNodes(treeView1.Nodes);
}
private void RemoveCheckedNodes(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
if (node.Checked)
{
nodes.Remove(node);
}
else
{
RemoveCheckedNodes(node.Nodes);
}
}
}
 
 
Thanks. 

Answers (2)