473,503 Members | 3,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

select all childs in a Treeview

Hi group. Merry Xmas one and all!!!! I hope Santa brings you all something
good. For me, I would be happy with some nice code!

If I check a node in a treeview, how do I check all childs of that node? I
wrote:
Dim Child As TreeNode = Nothing

For Each Child In myTreeView.Nodes

Child.Checked = True

Next

Now, as regular readers will know, collections are not my strong point. I
know that I have not told VB which node I am referring to when I run this
(the one I just checked is the one I want to refer to). What is missing in
my code? Or is it completely rubbish!??!!

--
Bob Hollness

-------------------------------------
I'll have a B please Bob
Nov 21 '05 #1
2 2136
The nodes of a treeview are in fact collections of collection. When you get
the event for the check you will get a reference to the node which was
checked. You then use the same construct as you have in your code but
replace the myTreeView with the node that was checked.

Hope this helps.

Lloyd Sheen

"Bob Hollness" <bo*@blockbuster.com> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
Hi group. Merry Xmas one and all!!!! I hope Santa brings you all
something good. For me, I would be happy with some nice code!

If I check a node in a treeview, how do I check all childs of that node?
I wrote:
Dim Child As TreeNode = Nothing

For Each Child In myTreeView.Nodes

Child.Checked = True

Next

Now, as regular readers will know, collections are not my strong point. I
know that I have not told VB which node I am referring to when I run this
(the one I just checked is the one I want to refer to). What is missing
in my code? Or is it completely rubbish!??!!

--
Bob Hollness

-------------------------------------
I'll have a B please Bob

Nov 21 '05 #2
this is exactly what I needed! thanks!

--
Bob Hollness

-------------------------------------
I'll have a B please Bob

"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:Lr********************@rogers.com...
The nodes of a treeview are in fact collections of collection. When you
get the event for the check you will get a reference to the node which was
checked. You then use the same construct as you have in your code but
replace the myTreeView with the node that was checked.

Hope this helps.

Lloyd Sheen

"Bob Hollness" <bo*@blockbuster.com> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
Hi group. Merry Xmas one and all!!!! I hope Santa brings you all
something good. For me, I would be happy with some nice code!

If I check a node in a treeview, how do I check all childs of that node?
I wrote:
Dim Child As TreeNode = Nothing

For Each Child In myTreeView.Nodes

Child.Checked = True

Next

Now, as regular readers will know, collections are not my strong point.
I know that I have not told VB which node I am referring to when I run
this (the one I just checked is the one I want to refer to). What is
missing in my code? Or is it completely rubbish!??!!

--
Bob Hollness

-------------------------------------
I'll have a B please Bob


Nov 21 '05 #3

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

Similar topics

2
11106
by: Piet | last post by:
Hi there, I have managed to write a small java program that display an xml file in a JTree. This was achieved by defining a suitable tree model. THe program works...somehow. The nodes (elements...
3
43559
by: someone | last post by:
Here is my code: TreeNodeCollection nodes = tvwFolders.Nodes; if (nodes.Count > 0) { // Select the root node tvwFolders.SelectedNode = nodes; } I hope there is an easier way. I looked at...
4
20368
by: G Uljee | last post by:
How can I find and select an specific item in an treeview control? I want to create a search feature on my treeview. Thanks in advance, Gaby
13
9033
by: André Nogueira | last post by:
Hi there. I know you can view a node's fullpath property, but is it posible to select a node using its path? Like, tell the treeview that the node that should be selected is the node with the...
4
6909
by: praveen | last post by:
I have a form with treeview control loaded from xml document,text box, two buttons named "Find" and "FindNext" and my treeview which looks like below. Details |__ policy status |__ created by...
4
9596
by: KarlM | last post by:
Hallo! I'm filling my treenode tv with AD-infos with the following code: ____________________________________________________________________ private enum AdImages { AdRoot, Ou, Container,...
3
21837
by: Michael_Burgess | last post by:
Hi there, I've looked around the different groups and still can't figure this out without resorting to scrappy code............ I want to programtically select and highlight a TreeView node,...
4
1821
by: HeavyD | last post by:
I am populating a treeview in C# from a SQL Server 2005 database. Table tree( id int, parent_id int, name varchar(50). The treeview is populated succesfully and when I select a node it is...
2
1960
by: Luqman | last post by:
I have filled a treeview with parents and childs, using Hashtables. Now, how can I check the required Parent and its Child Nodes. for example, I have following data Group Item A Item A1...
0
7192
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
7064
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
7315
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...
1
4991
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...
0
4665
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...
0
3158
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...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
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...

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.