list of files in an specific folder

  • Thread starter Thread starter ALI-R
  • Start date Start date
Private Function FileList(ByVal Dirpath As String) As String

Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder

For Each f As String In Directory.GetFiles(Dirpath)

sb.Append(String.Format("{0}{1}", f, Environment.NewLine))

Next

Return sb.ToString

End Function


public
 
mea culpa

I'm bi, (By that, I mean I read and reply in both groups :) )

It was such a "BASIC" question, I instinctively replied with a BASIC answer.
 
This is the C# newsgroup!

using System.IO;
....
public void test(string strPath)
{
if (Directory.Exists(strPath))
{
foreach (string s in Directory.GetFiles(strPath))
{
MessageBox.Show(s);
}
}
}

Look at the Directory class in the online help to learn more.

ShaneB
 
Back
Top