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.
- Right click on your project and select "Properties"
- Visit the "Settings" tab (click to link to create a new file if none
- Access your settings from the code:
-
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
Post a Comment