473,396 Members | 1,879 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,396 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 1536
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 ??
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.