473,662 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set all nodes checked = false, on a treeview

I need to set all nodes on a treeview so that checked=0

Is there a good way to do that?
Thanks
Nov 21 '05 #1
5 4207
Assuming that you mean after all the nodes have been added, you would have
to do a recursive read of all the nodes and set them to checked = false. I
am sure if you google you will find the recursive code for getting all the
nodes , (I do have a routine to do that but searching for it has not worked
to find that).

If you want to set them to checked = false when you load them, then you must
create a node and set it to unchecked and then add it as you would normally
do.

Lloyd Sheen

" Just Me" <ne********@a-znet.com> wrote in message
news:uP******** ******@TK2MSFTN GP15.phx.gbl...
I need to set all nodes on a treeview so that checked=0

Is there a good way to do that?
Thanks

Nov 21 '05 #2
Here's a little something that ought to get you started....

HTH
Kejpa
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Dim oNode As TreeNode

For Each oNode In TreeView1.Nodes

oNode.Checked = CheckState.Chec ked

ToggleNodeCheck (oNode, CheckState.Chec ked)

Next

End Sub

Private Sub ToggleNodeCheck (ByVal Node As TreeNode, ByVal State As
CheckState)

Dim oSubNode As TreeNode

For Each oSubNode In Node.Nodes

oSubNode.Checke d = State

ToggleNodeCheck (oSubNode, State)

Next

End Sub
Nov 21 '05 #3
Thanks to both.
" Just Me" <ne********@a-znet.com> wrote in message
news:uP******** ******@TK2MSFTN GP15.phx.gbl...
I need to set all nodes on a treeview so that checked=0

Is there a good way to do that?
Thanks

Nov 21 '05 #4
Works great, Thanks
"Kejpa" <kS*******@saj. fi> wrote in message
news:cm******** **@gandalf.alco m.aland.fi...
Here's a little something that ought to get you started....

HTH
Kejpa
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Dim oNode As TreeNode

For Each oNode In TreeView1.Nodes

oNode.Checked = CheckState.Chec ked

ToggleNodeCheck (oNode, CheckState.Chec ked)

Next

End Sub

Private Sub ToggleNodeCheck (ByVal Node As TreeNode, ByVal State As
CheckState)

Dim oSubNode As TreeNode

For Each oSubNode In Node.Nodes

oSubNode.Checke d = State

ToggleNodeCheck (oSubNode, State)

Next

End Sub

Nov 21 '05 #5
Thanks

"Lloyd Sheen" <sq************ *******@tostops pamhotmail.com> wrote in message
news:S4******** ************@ro gers.com...
Assuming that you mean after all the nodes have been added, you would have
to do a recursive read of all the nodes and set them to checked = false.
I am sure if you google you will find the recursive code for getting all
the nodes , (I do have a routine to do that but searching for it has not
worked to find that).

If you want to set them to checked = false when you load them, then you
must create a node and set it to unchecked and then add it as you would
normally do.

Lloyd Sheen

" Just Me" <ne********@a-znet.com> wrote in message
news:uP******** ******@TK2MSFTN GP15.phx.gbl...
I need to set all nodes on a treeview so that checked=0

Is there a good way to do that?
Thanks


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2172
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format is particular usefull to be bind to a treeview as it handle nodes. So I have try to save my dataset content into a xml file. The content of that file is as follow : - <NewDataSet> - <REC_INFO>
2
809
by: serge calderara | last post by:
Dear all, I am populating a treeview control with an XML file. I need to skip duplicate node entry from XML file in treeview if exit For that I ma using the following line of code : If NodeCollection.Contains(node) Then Return True That function always return false.
2
1674
by: ThunderMusic | last post by:
Hi, while I'm searching into a treeview to find a specific node, I find the code duplicating treeview nodes I just can't figure out what's causing this behavior, maybe some of you already encountered this problem. Can someone help please? Here is the code of the functions causing this problem Thanks
1
2770
by: RickDee | last post by:
Is there a command where I can check ( putting a tick mark ) all the nodes within a treeview when the user checked the topnode of the tree ?? thanks regards.
2
22023
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. Thanks in advance for any help, Jack
0
2021
by: skedward | last post by:
Dear Sir, I would like to check if the dynamically load nodes can still fire the onselectednodechanged. Even if I changed to SelectExpand, it still does not work. My code is as follows. Please help. Thanks.
1
3272
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file exists just to sort of synchronize them by changing the xml nodes attribute(s). somehow i always catch an exception "blabla has an invalid token" but i cannot find a solution for this. maybe someone of you people can tell me how to do this...
1
2596
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file exists just to sort of synchronize them by changing the xml nodes attribute(s). somehow i always catch an exception "blabla has an invalid token" but i cannot find a solution for this. maybe someone of you people can tell me how to do this...
0
2497
by: Mark Rae | last post by:
Hi, Adding nodes to a TreeView programatically... 1) Instantiate a TreeNode object and set its SelectAction to TreeNodeSelectAction.Expand. 2) Instantiate another TreeNode object and add it to the first TreeNode's ChildNodes collection.
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.