Saturday, July 27, 2019

directory selection component in C#

directory selection component in C#

  1. 4 ways to enable the latest C# features
  2. Thread: Save FolderBrowserDialog selection to file (config.txt)? share-icon
  3. It's real simple to use the built-in Settings functionality.

    To add a setting, just right click on your forms project in the solution explorer and choose, "Properties".

    On the left, click on the Settings tab.

    Enter a new setting (I called mine 'MySavedFolder'). Choose the type and visibility (User or application). I chose User. Give the setting a default value (I used 'default value').

    Next, wire up the setting in the forms code. I created a simple test form with an textbox and a save button. In the form editor, double click on the button to create a button handler.

    Next, wire up the setting.

    public partial class Form1 : Form { public Form1() { InitializeComponent(); // Retrieve the settings and load it into the textbox textBox1.Text = Properties.Settings.Default.MySavedFolder; } private void saveButton_Click(object sender, EventArgs e) { // Save the value from the textbox into the settings. Properties.Settings.Default.MySavedFolder = textBox1.Text; Properties.Settings.Default.Save(); } }

  4. How to use OpenFileDialog to select a folder?
  5. this link contains lot of good info. all kinds of component need to take a look and play around it.

  6. .NET Win 7-style folder select dialog
  7. Common dialog classes for Windows Forms applications
  8. RichTextBox Class
  9. FolderBrowserDialog Class
  10. How to: Choose Folders with the Windows Forms FolderBrowserDialog Component
  11. FolderBrowserDialog In C#
  12. C# FolderBrowserDialog Control
  13. Let the user select a folder in C#
  14. The second useful technique is that the program saves the user’s selection between runs. At design time I created a setting named Directory. To create a setting, double-click the Properties entry in Solution Explorer and go to the Settings tab.

    When it starts, the program uses the following code to load the value saved in this setting.

    // Restore the saved directory. private void Form1_Load(object sender, EventArgs e) { txtDirectory.Text = Properties.Settings.Default.Directory; }

    The program uses the following code to save the current selection when the form closes.

    // Save the current directory. private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Properties.Settings.Default.Directory = txtDirectory.Text; Properties.Settings.Default.Save(); }

  15. Browse for a Folder in C# Winforms
  16. Example for FolderBrowserDialog in C#
  17. C# OpenFileDialog and FolderBrowserDialog to select Files & Folder
  18. Winform : How to use Folder and Open File Dialog Controls using C#
  19. Set InitialDirectory for FolderBrowserDialog
  20. How to Build a 'Folder Watcher' Service in C#
.

No comments:

Post a Comment