E
E
Eugene2014-01-17 13:16:52
.NET
Eugene, 2014-01-17 13:16:52

Saving settings via settings

Hello.
I use the program to save settings (for example, to connect to the database) through Property.Settings, but after recompilation they fail.

Settings.Default.server = txt_server.Text;
Settings.Default.user = txt_login.Text;
Settings.Default.password = txt_password.Text;
Settings.Default.bdname = txt_bdname.Text;
Settings.Default.Save();

How would you save all this, so that once and for all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2014-01-17
@gloomkolomna

Thanks for the clarification, then I know what's the matter :-)
Just add one more parameter to the settings, for example CallUpdate with the default value "true", and when loading the settings, use the following code:

if (Settings.Default.CallUpgrade)
{
  Settings.Default.Upgrade();
  Settings.Default.CallUpgrade = false;
}
// Далее использование настроек.

Then, when updating the version, it will pick up all possible settings from the previous version.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question