Treeview in windows application
-
Hi, I have a problem with treeview in windows application for example i have a treeview as follows with checkboxes:- Root0 Node0 Node1 Root1 Node2 Node3 now if i checked node0 nothing will happn with root0 but if node0 and node1 both are checked thn root0 can be shows as checked and if i check on root0 thn both nodes with be checked automatically i m trying soo hard but m found nothing still, can anyone help me with it
-
Hi, I have a problem with treeview in windows application for example i have a treeview as follows with checkboxes:- Root0 Node0 Node1 Root1 Node2 Node3 now if i checked node0 nothing will happn with root0 but if node0 and node1 both are checked thn root0 can be shows as checked and if i check on root0 thn both nodes with be checked automatically i m trying soo hard but m found nothing still, can anyone help me with it
Firstly I would suggest that you explain what you have done more, possibly show some code as we can then potentially see where the problem is rather than guess. Secondly I wouldn't post your problem multiple times as this is condsidered rude / bad form.
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
-
Hi, I have a problem with treeview in windows application for example i have a treeview as follows with checkboxes:- Root0 Node0 Node1 Root1 Node2 Node3 now if i checked node0 nothing will happn with root0 but if node0 and node1 both are checked thn root0 can be shows as checked and if i check on root0 thn both nodes with be checked automatically i m trying soo hard but m found nothing still, can anyone help me with it
Please don't repost. Modify the original question if you have to.
Apps - Color Analyzer | Arctic | XKCD | Sound Meter | Speed Dial
-
Hi, I have a problem with treeview in windows application for example i have a treeview as follows with checkboxes:- Root0 Node0 Node1 Root1 Node2 Node3 now if i checked node0 nothing will happn with root0 but if node0 and node1 both are checked thn root0 can be shows as checked and if i check on root0 thn both nodes with be checked automatically i m trying soo hard but m found nothing still, can anyone help me with it
Arun kumar Gautam wrote:
now if i checked node0 nothing will happn with root0 but if node0 and node1 both are checked thn root0 can be shows as checked
and if i check on root0 thn both nodes with be checked automatically
i m trying soo hard but m found nothing still, can anyone help me with itI'd expect this behaviour; can you explain why you think it's wrong?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
Arun kumar Gautam wrote:
now if i checked node0 nothing will happn with root0 but if node0 and node1 both are checked thn root0 can be shows as checked
and if i check on root0 thn both nodes with be checked automatically
i m trying soo hard but m found nothing still, can anyone help me with itI'd expect this behaviour; can you explain why you think it's wrong?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
wel m now able to resolve it by using #region TreeView private void CheckChildNode(TreeNode currNode) { //set the children check status to the same as the current node bool checkStatus = currNode.Checked; foreach (TreeNode node in currNode.Nodes) { node.Checked = checkStatus; CheckChildNode(node); } } private void CheckParentNode(TreeNode currNode) { TreeNode parentNode = currNode.Parent; if (parentNode == null) return; parentNode.Checked = true; foreach (TreeNode node in parentNode.Nodes) { if (!node.Checked) { parentNode.Checked = false; break; // TODO: might not be correct. Was : Exit For } } CheckParentNode(parentNode); } #endregion
private void menuCollection_AfterCheck(object sender, TreeViewEventArgs e)
{
menuCollection.AfterCheck -= menuCollection_AfterCheck;
CheckChildNode(e.Node);
CheckParentNode(e.Node);
menuCollection.AfterCheck+=menuCollection_AfterCheck;
}hope this code helps someone in future