Click here to Skip to main content
16,012,107 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,

I am using Treeview Control with Checkbox in my windows application , i want to uncheck all the checkbox in Treeview but WITHOUT using FOR LOOP. If i use FOR LOOp means its taking long time if i have vry large data means , So can any one suggest me to Uncheck all Nodes and ChildNodes in Treeview WITHOUT using FOR LOOP. :) Thanks in Advance. :)
Posted
Updated 17-Jul-13 1:06am
v2

1 solution

See
check-and-uncheck-all-the-nodes-of-the-tree-view-in-c-sharp[^]

Note that you tried to avoid going through the elements, which of course is impossible.
the solutions could vary, using iteration or recursion.

Another thing you can optionally do is do lazy uhchecking, meaning that you uncheck only the displayed nodes, and when someone opens tree nodes uncheck all those as well.
This approach has its disadvantages like if your app drops suddenly those unopened are unchanged, but I guess if unchecking takes too long for you, then you probably used lazy loading of the nodes too...

* How big is your tree that unchecking all nodes is so time consuming??

Good luck,
Edo
 
Share this answer
 
Comments
SARAVANAKUMAR.M 17-Jul-13 7:25am    
Thanks for your reply Maimonides, I want to uncheck all nodes in treeview Without using FOR LOOP, because i will be having more than 5lakhs of nodes in treeview (Including All childNodes), so it will take very long time to uncheck all nodes in treeview , is there any other way to uncheck all nodes on any Button Click(Clear Button)?.:)
Joezer BH 17-Jul-13 7:27am    
Tell me something, how did you load all the nodes to the tree view in the first place?

[ Nope :( there's no way of doing this in just one magic click ]
SARAVANAKUMAR.M 17-Jul-13 7:40am    
I am retrieving data's from Database & just adding to a one Permanent Root Node of a Treeview. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900