Products
Database Search Solution (New Version) Search Control SEO Pager Highlighter Shortcut Controls Crypt Package Free ASP.NET Controls
Geotargeting Component ASP.NET Media Player Control Flash Video Player Control Services
ASP.NET Telecommute Jobs Free IP Location Lookup Test .Net Regular Expressions CSS/Table/DIV Page Layouts Custom Programming Article Sites Master List |
How to select folder with modal FolderBrowserDialog?Very common programming task is to enable user to select some folder from disc or memory card. If you are creating .Net Windows Forms application, to solve this problem you can use FolderBrowserDialog class. FolderBrowserDialog class is inherited from CommonDialog class. FolderBrowserDialog class exampleCreate new Windows Forms project and place one label and one button control on form. Set button's ID to btnSelectFolder and Text property to "Select Folder...". Set label's ID property to lblSelectedFolder. Double click on button to create handler for click event, and write code like this: [ C# ] private void btnSelectFolder_Click(object sender, EventArgs e) [ VB.NET ] Private Sub btnSelectFolder_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowseFolder.Click Press F5 to start the example. If you click on button, modal dialog will appear. You can browse folders and select some folder from tree view. Press OK button to close the dialog. Label control will show full path of the selected folder. RemarksThere are few frequently used properties of FolderBrowserDialog class. You can use RootFolder property to define a starting folder. ShowNewFolderButton property defines if user is able to create new folder (default value is True). And finally, Description property defines text shown on the top of the dialog box. Tutorial toolbar: Tell A Friend | Add to favorites | Feedback | comments powered by Disqus |