The Folders looked all wrong with the formatting I gave thm... it could
cause confusion..so i'm reposting with a different fomat:
===================================
Hey everyone!
Basicaly what i'm doing is showing MessageBoxes with the contents of a
folder tree...
Example:
rootFolder (Folder1 "(" Folder2 *(* Folder3( F3File1, F3File2)
F2File1,F2File2* )* F1File1,F1File2 ")" RFFile1, RFFile2 )
It might take you a while but you'll probably see how the folder tree is
structured... the " * characters with the brackets are just to tell the
difference between them, reference.
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 F2File2 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(NextFolder);
}
}
Thnx in advance!
Benjamin Vigneaux, 4 1160
Benjamin Vigneaux wrote:
The Folders looked all wrong with the formatting I gave thm... it could
cause confusion..so i'm reposting with a different fomat:
===================================
Hey everyone!
Basicaly what i'm doing is showing MessageBoxes with the contents of a
folder tree...
Example:
rootFolder (Folder1 "(" Folder2 *(* Folder3( F3File1, F3File2)
F2File1,F2File2* )* F1File1,F1File2 ")" RFFile1, RFFile2 )
It might take you a while but you'll probably see how the folder tree is
structured... the " * characters with the brackets are just to tell the
difference between them, reference.
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 F2File2 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(NextFolder);
}
}
Thnx in advance!
Benjamin Vigneaux,
I don't see anything wrong with the code.
Why do you think that you can't get the contents of Folder3? I.E. what
happens when you try?
Have you verified that Folder3 actually contains anything?
--
Göran Andersson
_____ http://www.guffa.com
On Jun 14, 4:51 pm, "Benjamin Vigneaux" <b...@mi.clwrote:
The Folders looked all wrong with the formatting I gave thm... it could
cause confusion..so i'm reposting with a different fomat:
===================================
Hey everyone!
Basicaly what i'm doing is showing MessageBoxes with the contents of a
folder tree...
Example:
rootFolder (Folder1 "(" Folder2 *(* Folder3( F3File1, F3File2)
F2File1,F2File2* )* F1File1,F1File2 ")" RFFile1, RFFile2 )
It might take you a while but you'll probably see how the folder tree is
structured... the " * characters with the brackets are just to tell the
difference between them, reference.
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 F2File2 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(NextFolder);
}
}
Thnx in advance!
Benjamin Vigneaux,
Not sure but
protected void MessContents(DirectoryInfo root)
{
// when root =Folder3 , There are are not directories
foreach (DirectoryInfo NextFolder in
root.GetDirectories())
{
MessageBox.Show(NextFolder.Name);
foreach (FileInfo NextFile in root.GetFiles())
{
MessageBox.Show(NextFile.Name);
}
MessContents(NextFolder);
}
}
I think this could help. not tested it though
foreach (FileInfo fi in di.GetFiles())
{
if ((fi.Attributes & FileAttributes.Directory) !=
FileAttributes.Directory)
{
//is file
}
else if ((fi.Attributes & FileAttributes.Directory) ==
FileAttributes.Directory)
{
//recurse
}
}
parez wrote:
// when root =Folder3 , There are are not directories
Good point. That is the problem.
However, the simple solution is to just move the file loop outside the
folder loop:
protected void MessContents(DirectoryInfo root) {
foreach (FileInfo NextFile in root.GetFiles()) {
MessageBox.Show(NextFile.Name);
}
foreach (DirectoryInfo NextFolder in root.GetDirectories()) {
MessageBox.Show(NextFolder.Name);
MessContents(NextFolder);
}
}
--
Göran Andersson
_____ http://www.guffa.com
On Jun 15, 4:57 am, Göran Andersson <gu...@guffa.comwrote:
parez wrote:
// when root =Folder3 , There are are not directories
Good point. That is the problem.
However, the simple solution is to just move the file loop outside the
folder loop:
protected void MessContents(DirectoryInfo root) {
foreach (FileInfo NextFile in root.GetFiles()) {
MessageBox.Show(NextFile.Name);
}
foreach (DirectoryInfo NextFolder in root.GetDirectories()) {
MessageBox.Show(NextFolder.Name);
MessContents(NextFolder);
}
}
--
Göran Andersson
_____http://www.guffa.com
hehe.. I missed that.. I was watching semi-pro when i replied to that
post. Will ferrel's worst movie ever This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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)
...
|
by: Johan Bergman |
last post by:
Hi,
Maybe someone can help me with this one. The following describes a
somewhat simplified version of my problem, but I think it will be
sufficient.
I want to use class factories (virtual...
|
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...
|
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...
|
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...
|
by: GysAnn |
last post by:
Hello,
I'm looking for a function for converting the input to a regular text.
Example: when the input is "aBCdefgHI jkLM ooPP" the return value of the
function should be "Abcdefghi Jklm...
|
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...
|
by: Uwe Grawert |
last post by:
I have the following recursive function:
string find_value_by_key (xmlDocPtr doc,
xmlNodePtr root_node,
const string& key)
{
while(root_node != NULL)
{
if(! xmlStrcmp( root_node->name,...
|
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,...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |