My.settiings Setting dont read at Form load?

  • Thread starter Thread starter PetterL
  • Start date Start date
P

PetterL

I have a setting called My.settings.firstrun set to True, set in the setting
manager. When i read this in the first form form_Load in a IF sentence it
always come out as false.
I have tried to change the setting from string to Boolean but no help.
 
Firstly: Are you sure you're saving your settings when the app terminates?
You can do this manually with a call to My.Settings.Save, or set an option
in the Project Properties to auto-save your settings when your app
terminates.

Secondly: I seem to recall that settings are stored on a per-version basis,
so if you're rebuilding and executing, you may find that you end up with a
"fresh" set of settings for your new version. I think there's a call like
My.Settings.Upgrade that can get around this.

Hope that helps,
Alex
 
The default of this setting is set to True in the settin manager before the
program starts.
I dont try to change the value. Just read the setting value when the
application starts in the startup form Form_load.to check if it is the first
time application runs,.

But even when the setting in the manager by default says TRUE the value
returned from my.settings.firstrun is FALSE.
Other settings that are used later is OK.
I tried to rebuild the application but stil same result
 
Steve Gerrard said:
After the first time you run it, it will save the changed setting as
False, just for you. You can use the settings manager to clean out all
saved settings, which will reset you to first time = True. Once. After
that, if your code changes it, it will be whatever it last was again.
OK then may be this is the wrong way to do what I want to do. If the value
is always False the before the program change it. EVEN when the default
value in settings manager on that item is set to TRUE. This not make sense.
I have tried to reload before reading. If I change the value before I check
its value. Then it will be this value every toime i start the program, I
just want this value set on the first time.

I have no problem with the other settings in settings manager.

Is there some other way to do the following. I want to open up the setup
form when it is the first time program starts. Next time it open up without
open setup screen.
 
PetterL said:
OK then may be this is the wrong way to do what I want to do. If the value
is always False the before the program change it. EVEN when the default
value in settings manager on that item is set to TRUE. This not make
sense. I have tried to reload before reading. If I change the value before
I check its value. Then it will be this value every toime i start the
program, I just want this value set on the first time.

I have no problem with the other settings in settings manager.

Is there some other way to do the following. I want to open up the setup
form when it is the first time program starts. Next time it open up
without open setup screen.

Sorry to reply on my self but.

I tried to turn the problem around and let the false be start value but
after a few testing, now has the True become default even when the
my.setting.firstrun has been set to false.
 
Steve Gerrard said:
That is what you have programmed it to do; your code is working correctly.
After the first time you run it - even in Debug in the IDE - it saves the
new setting. That is what User Settings do.

To reset the settings, go to My Project and double click it. Go the to
Settings tab. Click the Synchronize button, which will delete the saved
user config files from your test runs, so that the default values you have
set will apply again. That will work for exactly one test run; after that,
it will have saved your personal settings again. That's what user settings
are supposed to do.

Thank's I got it this time. But i had a minor problem i think. When i sync i
get a message that the IDE can't find the file on any of a list of paths.
Then I wanted to try to copy the file to one of the paths but could not
find it since the program has never been installed on the developer PC.

It was pointed to a map under Application data or Local setting.
 
Back
Top