473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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 4189
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**************@TK2MSFTNGP15.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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim oNode As TreeNode

For Each oNode In TreeView1.Nodes

oNode.Checked = CheckState.Checked

ToggleNodeCheck(oNode, CheckState.Checked)

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.Checked = 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**************@TK2MSFTNGP15.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.alcom.aland.fi...
Here's a little something that ought to get you started....

HTH
Kejpa
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim oNode As TreeNode

For Each oNode In TreeView1.Nodes

oNode.Checked = CheckState.Checked

ToggleNodeCheck(oNode, CheckState.Checked)

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.Checked = State

ToggleNodeCheck(oSubNode, State)

Next

End Sub

Nov 21 '05 #5
Thanks

"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:S4********************@rogers.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**************@TK2MSFTNGP15.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
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...
2
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...
2
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...
1
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
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. ...
0
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....
1
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...
1
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...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.