473,473 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Recursive Reading

Hey everyone!

Basicaly what i'm doing is showing MessageBoxes with the contents of a
folder tree...

Example:

rootFolder -Folder1 - Folder2 - Folder3 - F3File1
RFFile1 F1File1 F2File1
F3File2
RFFile2 F1File2 F2File2
F3File3
RFFile3 F1File3 F2File3

RF"name" or F#"name" is to tell you in wich folder a file is, it's just for
reference, RFFile1,for example, is in the Root Folder, and F2File3 is in
Folder2

My problem is: With the folowing code I can only get to the contents of
Folder2 which are Folder3, F2File1 etc etc...
but I can't get to the contents within Folder3.... could anyone suggest me
what to do? (I know it's quite simple, but i've been so many hours looking
at it that I can't see it!
protected void MessContents(DirectoryInfo root)
{

foreach (DirectoryInfo NextFolder in root.GetDirectories())
{
MessageBox.Show(NextFolder.Name);

foreach (FileInfo NextFile in root.GetFiles())
{
MessageBox.Show(NextFile.Name);
}

MessContents(CarpetaSiguiente);
}
}

Thnx in advance!

Benjamin Vigneaux,

Jun 27 '08 #1
2 1047
On Sat, 14 Jun 2008 13:26:12 -0700, Benjamin Vigneaux <be**@mi.clwrote:
[...]
rootFolder -Folder1 - Folder2 - Folder3 - F3File1
RFFile1 F1File1 F2File1 F3File2
RFFile2 F1File2 F2File2 F3File3
RFFile3 F1File3 F2File3
Just FYI: if you're going to try to use text to line things up, you need
to write your post using a fixed-pitch font. Using a proportional-pitch
font, then there's no way to ensure that the recipient sees what you see.

In other words, I have little idea what the above is supposed to
represent. Nothing lines up on my screen.
[...]
My problem is: With the folowing code I can only get to the contents of
Folder2 which are Folder3, F2File1 etc etc...
but I can't get to the contents within Folder3.... could anyone suggest
me what to do? (I know it's quite simple, but i've been so many hours
looking at it that I can't see it!
What isn't working for you? The code you posted doesn't even seem like it
would compile, as the argument you're passing to "MessContents" from
within "MessContents" doesn't appear to be declared anywhere.

It's possible that your question can be answered without a _complete_ code
sample (even though complete samples are generally better), but it should
at least be a code sample that is at least reasonably self-evident. What
you posted isn't.

For what it's worth, other than the fact that the argument you're passing
to "MessContents" seems completely random, the code you posted seems
reasonable. In other words, probably your problem is just that you're not
passing the right thing to the method. It seems like you ought to be
passing "NextFolder", rather than whatever "CarpetaSiguiente" represents.

Pete
Jun 27 '08 #2
On Jun 14, 7:39 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Sat, 14 Jun 2008 13:26:12 -0700, Benjamin Vigneaux <b...@mi.clwrote:
[...]
rootFolder -Folder1 - Folder2 - Folder3 - F3File1
RFFile1 F1File1 F2File1 F3File2
RFFile2 F1File2 F2File2 F3File3
RFFile3 F1File3 F2File3

Just FYI: if you're going to try to use text to line things up, you need
to write your post using a fixed-pitch font. Using a proportional-pitch
font, then there's no way to ensure that the recipient sees what you see.

In other words, I have little idea what the above is supposed to
represent. Nothing lines up on my screen.
[...]
My problem is: With the folowing code I can only get to the contents of
Folder2 which are Folder3, F2File1 etc etc...
but I can't get to the contents within Folder3.... could anyone suggest
me what to do? (I know it's quite simple, but i've been so many hours
looking at it that I can't see it!

What isn't working for you? The code you posted doesn't even seem like it
would compile, as the argument you're passing to "MessContents" from
within "MessContents" doesn't appear to be declared anywhere.

It's possible that your question can be answered without a _complete_ code
sample (even though complete samples are generally better), but it should
at least be a code sample that is at least reasonably self-evident. What
you posted isn't.

For what it's worth, other than the fact that the argument you're passing
to "MessContents" seems completely random, the code you posted seems
reasonable. In other words, probably your problem is just that you're not
passing the right thing to the method. It seems like you ought to be
passing "NextFolder", rather than whatever "CarpetaSiguiente" represents.

Pete
CarpetaSiguiente is next folder in spanish.;)
Jun 27 '08 #3

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

Similar topics

2
by: Kaptain524 | last post by:
Hello, I am using PHP 5.0.4 with Apache 2, on WinXP Pro. This behavior appears to be fundamental however, and should not be affected by platform. It would seem that there is some kind of bug...
2
by: Xavier Decoret | last post by:
I am reading the lines of a file, executing appropriate command if a pattern is found. One of the pattern can be a input command whose effect should be to #include the file (possibly recursively) ...
1
by: John-Orr | last post by:
hi guys have a problem....... an XML problem basically my XML looks like this <heritage> <parent>343453 <parent>35634654 <parent>456456 <parent>456456 ..........loads more nested parent...
1
by: Varun Kacholia | last post by:
Hello All, I wanted to know whether recursive selects are supported in the latest version of postgres. I checked out the unimplemented sql constructs and came to know that "with recursive" is...
5
by: Petr Bravenec | last post by:
I have found that when I use the RETURN NEXT command in recursive function, not all records are returned. The only records I can obtain from function are records from the highest level of...
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...
25
by: Mike MacSween | last post by:
Regular viewers may want to turn off now. This will be an orchestral management system. Musicians and other staff being booked/paid for jobs. A job may contain other jobs, e.g: World Tour...
5
by: Seong-Kook Shin | last post by:
Hi, I'm reading Steve's "C Programming FAQs" in book version, and have two question regarding to Q11.16 ... Also, a `return' from `main' cannot be expected to work if data local to main might be...
11
by: randomtalk | last post by:
hi, i have the following recursive function (simplified to demonstrate the problem): >>> def reTest(bool): .... result = .... if not bool: .... reTest(True) .... else: .... print...
0
by: Kim G | last post by:
Hi. I am having some trouble with a recursive function that displays a menu. In my database I have two fields that matters: page_id and parent_id. Displaying the menu correctly is not a problem,...
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
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
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,...
0
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
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
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.