|
-
Mar 6th, 2005, 12:09 PM
#1
Thread Starter
Fanatic Member
List files in a directory
For some reason..I thought this would be easy, but it is giving me a fit. I want to display a list of files in a listbox (or whatever is appropriate) from a directory. I just can't seem to work it out. Help!
-
Mar 6th, 2005, 02:00 PM
#2
Re: List files in a directory
 Originally Posted by birthjay
For some reason..I thought this would be easy, but it is giving me a fit. I want to display a list of files in a listbox (or whatever is appropriate) from a directory.  I just can't seem to work it out. Help!
MSDN
System.IO namespace
DirectoryInfo
FileInfo
-
Mar 7th, 2005, 02:43 AM
#3
Lively Member
Re: List files in a directory
should be correct syntax ;
for each (string s in System.IO.Directory.GetFiles(@"folderPath")
{
ListBox1.Items.Add(s);
}
-
Mar 7th, 2005, 04:01 AM
#4
Re: List files in a directory
I think the filename is returned from the ToString() method so just to be annoying
Code:
ListBox1.Items.AddRange(Directory.GetFiles("path"));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|