Jun 9, 2011

TreeView Control. Checkboxes. And clicking.Unchcek/Check



     void ManageTreeChecked(TreeNode node)
      {
   foreach(TreeNode n in node.Nodes)
   {
      n.Checked = node.Checked;
     }
}

        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            ManageTreeChecked(e.Node);
        }

        private void treeView1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
            {
                ManageTreeChecked(treeView1.SelectedNode);
            }
        }


using the above code you can check and UN check the check boxes in the tree view



No comments:

Post a Comment