0

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);
            }
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by __avd
0
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);
            }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.