[C#] List folders in a combo box
Hello,
I seem to be having trouble with C#, as I am learning.
I want to, on the form load:
- Have a combo box find the folders listed in the "database" directory, and show them.
So when you click the combo box to drop it down, what's dropped down is the folder names.
Any help?
Thanks!,
Cask.
Re: [C#] List folders in a combo box
i don't think theres a component to do this on a form (Unlike Visual Basic with the Directory List Box etc)
However there is the Folder Browser Dialog in C# which is really easy to use! :) (Its the same thing as when you click find folder in word or whatever - theres also a file browser dialog to find files rather than folders if thats what you were after, its used the same way)
Code:
folderBrowserDialog1.ShowDialog();
txtFolderPath.Text = folderBrowserDialog1.SelectedPath;
Like that! :) hope this helped. If you really want it on your form than you can use System.IO along with a ListBox and write the code yourself, although i frind the Folder Browser Dialog is both quicker, easier and looks much nicer!
~ Jeax
Re: [C#] List folders in a combo box
Wasn't quite what I was looking for but you helped me a great deal.
Thanks ;)