Tuesday, December 4, 2012

How to Add Folder Browser Dialog Option to Your C# CSharp Program


I am writting these programs in C# "C Sharp" and always needed to give the user the option to select a folder.  Well, this should not be a segnificant task.  Dialog folders are always been provided by the toolbox in Visual Studio, Open, Save, Print, Font, etc...  so the Folder Browser should not be an issue.  So, I spent all day looking for a way to give the user the option to select a folder in my program.  search all over the internet and all blogs.  found a lot of feed back, but wow, that was so much to do to add this little option to my program.   So finally I look in my toolbox components and I saw it.  the Folderbrowserdialog component.  it is there!!!
 
all you have to do is add this to a button click: 
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
Selected_Folder_Button.Text = folderBrowserDialog1.SelectedPath;
}
I can not believe all that talk out there on the internet and complecated feed back, this is two lines of code!!!!

No comments:

Post a Comment