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. :mad: I just can't seem to work it out. Help!
Printable View
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. :mad: I just can't seem to work it out. Help!
MSDNQuote:
Originally Posted by birthjay
System.IO namespace
DirectoryInfo
FileInfo
should be correct syntax ;
for each (string s in System.IO.Directory.GetFiles(@"folderPath")
{
ListBox1.Items.Add(s);
}
I think the filename is returned from the ToString() method so just to be annoying
Code:ListBox1.Items.AddRange(Directory.GetFiles("path"));