Thanks, I am just changing False to True, And I got Automatically Check TreeView Child Nodes When Parent Is Checked.
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
{
if (e.Node.Checked)
{
selectChildNodes(e.Node.Nodes);
}
else
{
DiselectChildNodes(e.Node.Nodes);
}
}
private void selectChildNodes(TreeNodeCollection childes)
{
foreach (TreeNode oneChild in childes)
{
if (oneChild.Checked==false)
oneChild.Checked = true;
selectChildNodes(oneChild.Nodes);
}
}
private void DiselectChildNodes(TreeNodeCollection childes)
{
foreach (TreeNode oneChild in childes)
{
if (oneChild.Checked)
oneChild.Checked = false;
DiselectChildNodes(oneChild.Nodes);
}
}