hello,

i am having a problem while displaying files present in the selected folder (using folderbrowserdialog) in a listbox. i had tried this but i didnt get it...
so can anyone suggest me if there is any error over here..
Thank u..

FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
            folderBrowserDialog1.ShowDialog();
            DialogResult result = this.folderBrowserDialog1.ShowDialog();
            if (result == DialogResult.OK)
            {
                string foldername = this.folerBrowserDialog1.SelectedPath;
                foreach (string f in Directory.GetFiles(foldername))
                    this.listBox1.Items.Add(f);
            }
FolderBrowserDialog fb = new FolderBrowserDialog();

            DialogResult result = fb.ShowDialog();
            if (result == DialogResult.OK)
            {
                string foldername = fb.SelectedPath;
                foreach (string f in Directory.GetFiles(foldername))
                    this.listBox1.Items.Add(f);
            }
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.