G
Guest
hi,
i am using vs 2005 and i have created a form, which uses DirectoryInfo /
FileInfo in order to find all files in one folder.
now i have created a textbox in the form and want it to be filled with the
output of my files in the relevant folder.
however the following code only shows the last of my files:
{
DirectoryInfo sourceDir = new
DirectoryInfo("C:\\users\\fritz\\desktop");
FileInfo[] files = sourceDir.GetFiles();
int i = 0;
foreach (FileInfo file in files)
{
txtOutput.Text = file;
}
}
instead of " txtOutput.Text = file;" i also used " txtOutput.Text =
files" --> same result.
any idea what is wrong in my code?
thanks in advance, fritz
i am using vs 2005 and i have created a form, which uses DirectoryInfo /
FileInfo in order to find all files in one folder.
now i have created a textbox in the form and want it to be filled with the
output of my files in the relevant folder.
however the following code only shows the last of my files:
{
DirectoryInfo sourceDir = new
DirectoryInfo("C:\\users\\fritz\\desktop");
FileInfo[] files = sourceDir.GetFiles();
int i = 0;
foreach (FileInfo file in files)
{
txtOutput.Text = file;
}
}
instead of " txtOutput.Text = file;" i also used " txtOutput.Text =
files" --> same result.
any idea what is wrong in my code?
thanks in advance, fritz