There are times when we want to save user preferences, setting or other types of data.
This can be done using WinForm User/Application Settings.
Example Use:
// Set the value and save
Properties.Settings.Default.TargetFolder
= textBoxDir.Text;
Properties.Settings.Default.Save();
public Form1()
{
InitializeComponent();
// use the value
if (Directory.Exists(Properties.Settings.Default.TargetFolder))
textBoxDir.Text =
Properties.Settings.Default.TargetFolder;
else
textBoxDir.Text = DefaultDirectory;
}
Comments
Post a Comment