473,232 Members | 1,504 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,232 software developers and data experts.

Recursion with a Tree View and checkboxes

I am creating a project that will populate a Tree View with information
from a Cd, Zip, or Floppy. I have the user selected the files they
want to copy.

Exampe: A:\ (Directory) X

- ABC1234 (Folder) X
- Test.html (File) X
- ZXY4567 (Folder)
- WTY5678 (Folder) X
- Test2.html (File) X
- Budget.xls (File)

X = items that the user selects

I want to be able to go through all the Tree Nodes and get the files
that have been selected. If the folder above the item is not selected I
still want the code to go into that folder to see if an item is
selected.

If someone could point me in the right direction I would greatly
appricate it.

VBNovice

Apr 25 '06 #1
2 1531
Take a look at this, I just posted it to help someone else. I only needed
to modify the search criteria to send to you.

'//Initial usage
'//Dim oChecked as Arraylist = Walktree(me.treeview1.nodes)

Private Function WalkTree(ByVal PNodes As TreeNodeCollection) As ArrayList

Dim oRet As ArrayList, iCount As Integer
Dim iTemp As ArrayList

oRet = New ArrayList
iCount = -1

For Each node As TreeNode In PNodes
If node.Checked Then
oRet.Add(node)
End If

iTemp = WalkTree(node.Nodes)
oRet.AddRange(iTemp.ToArray)

Next

Return oRet

End Function

"VBNovice05" <to****************@mda.mil> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I am creating a project that will populate a Tree View with information
from a Cd, Zip, or Floppy. I have the user selected the files they
want to copy.

Exampe: A:\ (Directory) X

- ABC1234 (Folder) X
- Test.html (File) X
- ZXY4567 (Folder)
- WTY5678 (Folder) X
- Test2.html (File) X
- Budget.xls (File)

X = items that the user selects

I want to be able to go through all the Tree Nodes and get the files
that have been selected. If the folder above the item is not selected I
still want the code to go into that folder to see if an item is
selected.

If someone could point me in the right direction I would greatly
appricate it.

VBNovice

Apr 25 '06 #2
AMDRIT,

Thanks for the help it worked just like I wanted to.
AMDRIT wrote:
Take a look at this, I just posted it to help someone else. I only needed
to modify the search criteria to send to you.

'//Initial usage
'//Dim oChecked as Arraylist = Walktree(me.treeview1.nodes)

Private Function WalkTree(ByVal PNodes As TreeNodeCollection) As ArrayList

Dim oRet As ArrayList, iCount As Integer
Dim iTemp As ArrayList

oRet = New ArrayList
iCount = -1

For Each node As TreeNode In PNodes
If node.Checked Then
oRet.Add(node)
End If

iTemp = WalkTree(node.Nodes)
oRet.AddRange(iTemp.ToArray)

Next

Return oRet

End Function

"VBNovice05" <to****************@mda.mil> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I am creating a project that will populate a Tree View with information
from a Cd, Zip, or Floppy. I have the user selected the files they
want to copy.

Exampe: A:\ (Directory) X

- ABC1234 (Folder) X
- Test.html (File) X
- ZXY4567 (Folder)
- WTY5678 (Folder) X
- Test2.html (File) X
- Budget.xls (File)

X = items that the user selects

I want to be able to go through all the Tree Nodes and get the files
that have been selected. If the folder above the item is not selected I
still want the code to go into that folder to see if an item is
selected.

If someone could point me in the right direction I would greatly
appricate it.

VBNovice


Apr 25 '06 #3

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

Similar topics

4
by: Dan | last post by:
I've encountered some strange behavior in a recursive procedure I'm writing for a bill of materials. First let me ask directly if what I think is happening is even possible: It seems like the...
3
by: csx | last post by:
Hi all, Ive got a problem with recursion in Javascript. For this tree: http://www.pcm.uklinux.net/structure.jpg If you input node 3 (i.e. C) which is represented as 'values' in the array, it...
12
by: Mikito Harakiri | last post by:
I wonder if WITH RECURSIVE MaryAncestor(anc,desc) AS ( (SELECT parent as anc, child as desc FROM ParentOf WHERE desc = "Mary") UNION (SELECT A1.anc, A2.desc FROM MaryAncestor A1, MaryAncestor...
43
by: Lorenzo Villari | last post by:
I've tried to transform this into a not recursive version but without luck... #include <stdio.h> void countdown(int p) { int x;
4
by: Ed Davis | last post by:
I'm trying to decide which of the following programming styles is better, as in easier to understand, and thus easier to maintain. Keep in mind that for posting purposes, this is a greatly...
10
by: paulw | last post by:
Hi Please give problems that "HAS TO" to use recursion (recursive calls to itself.) Preferrably real world examples, not knights tour. I'm thinking about eliminating the use of stack... ...
18
by: MTD | last post by:
Hello all, I've been messing about for fun creating a trial division factorizing function and I'm naturally interested in optimising it as much as possible. I've been told that iteration in...
35
by: Muzammil | last post by:
int harmonic(int n) { if (n=1) { return 1; } else { return harmonic(n-1)+1/n; } } can any help me ??
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.