c# - Persisting string value in .net Windows Form -


I think what is the easiest way to continue with a string value, once the form and program is closed I want to Use it again later when they open the program and form it later. In my case I am using a FolderBrowserDialog and I am saving the directory that the user has chosen.

I know that I file. I can use IO, but just thinking that everyone thinks that the easiest / most efficient / minimal lines

thanks!

Good and easy to use.

  1. Right click on your project and select "Properties"
  2. Visit the "Settings" tab (click to link to create a new file if none
  3. Access your settings from the code:
  • Enter your new settings with a name and default value (i.e. "MySaved Directory")
  • -

      Private string folder; Private Zero Form 1_load (Object Sender, EventAgds E) {this.folder = Properties.Settings.Default.MySavedDirectory; } Private Zero Form 1_formcling (Object Sender, FormClosingEventArgs e) {properties.Settings.Default.MySavedDirectory = this.folder; Properties.Settings.Default.Save (); }  

  • Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -