title: TreeView Selecting Parent nodes of a child, and childes of a selected parent
body: <p>I'm using Treeview, I have already found both of these functions and they work perfectly:</p>
  
  <pre><code>private void CheckChildren_ParentSelected(TreeNode node, Boolean isChecked)
      {
          foreach (TreeNode item in node.Nodes)
          {
              item.Checked = isChecked;
  
              if (item.Nodes.Count &gt; 0)
              {
                  this.CheckChildren_ParentSelected(item, isChecked);
              }
          }
      }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>private void SelectParents(TreeNode node, Boolean isChecked)
      {
          //MessageBox.Show(node.Parent.ToString());
          if (node.Parent!=null)
          {
              node.Parent.Checked = isChecked;
              SelectParents(node.Parent, isChecked);
          }
      }
  </code></pre>
  
  <p>here is the problem: when I call each of these functions separately in the AfterCheck event they work fine but when call both of them in the AfterCheck event nothing is happening even my form is not loading</p>
  
  <pre><code>private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
      {
          CheckChildren_ParentSelected(e.Node, e.Node.Checked);
          SelectParents(e.Node, e.Node.Checked);
  
         // MessageBox.Show("hi");
      }
  </code></pre>
  
  <p>This is not working! but when I comment on of them e.g. SelectParents function it will work, but when I have both of them nothing is happening even my form isn't loading</p>