hello,
Below is the C# code. When i run it i get an error saying
cannot convert char to string in the foreach statement. Please help me out...am unable to figure out whts the problem! awating replies.....

private void DisplayFiles(string DirPath)
        {
             string Root = null;
             Root = txtdestination.Text;
             string FileList = Directory.GetFiles(DirPath).ToString();
             string DirList = Directory.GetDirectories(DirPath).ToString();
           // string Filename = Filename.ToString();
            foreach(string Filename in FileList)
            {
                listBox1.Items.Add(Filename.Substring(Filename.LastIndexOf("\"") + 1));
                }
              foreach (string  DirName  in DirList)
                {
                    DisplayFiles(DirName);
            }

cya
Rohan

Recommended Answers

All 2 Replies

there is a problem in following line:
string FileList = Directory.GetFiles(DirPath).ToString();

it should be :
String[] FileList=..............

okie...ll try n let u knw...

cya
ROHAN

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.