Settings randomly not available

59 Views Asked by At

I've just started with Visual C#, with surprising success, however now I've run into an issue, that drives me crazy.

This problem applies to everything I've tried to write and I've not yet managed to formulate a successful Google search to answer my question.

I like to use the tabs Form, various tabs that to the "work" plus one Tab which contains a bunch of textboxes with the config data, like servername, logins, and so on.

I've also managed to save my settings using the builtin Settings feature.

Now here's my problem: I launch the application, access the settings tab, enter my settings, close the application. When i restart the application all my previous settings are retained. So far so good.

However, these textboxes which always contain the correct info whenever i click on my settingstab, return an empty string when accessed by a method. This behaviour is completely random, i launch the application, settings can be accessed, i close it, restart it settings are gone, next time they're there then gone again.

BUT, if i access the settings Tab, prior to running a method everything is fine.

Does this make an sense to anyone? All i do is define application settings and assign them to my textboxes in the settings tab and save them with Properties.Settings.Default.Save(); when the form is closed. I've tried manually loading them with the form ie: setSQLServer.Text = Properties.Settings.Default.setSQLServer; but the behaviour stays the same. A method run, prior to me clicking on the settings tab, randomly receives an empty string. When that happens all textboxes from the settings tab return empty strings.

0

There are 0 best solutions below