I've been able to get this code to work:
string[] path = Directory.GetFiles(@"c:\Users\james.krueger\Desktop\Test Folder\");
The problem is this displays the entire path.
This next block of code seems to be what I want. However, it prompts me with the error message that it cannot implicitly convert string
to string[]
.
Any ideas on how to get the file name alone?
string[] path = Path.GetFileName(@"c:\Users\james.krueger\Desktop\Test Folder\");
string[] filePaths = path;
foreach (string element in filePaths)
{
lb1.Items.Add(element);
}