Click here to Skip to main content
15,313,050 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ok so for user settings i use the My.Settings. Some of the settings are folder paths where files that my application creates are stored. For default values i use the Public user Documents folder (C:\Users\Public\Documents)

however when my app gets deployed to a test machine the settings are defaulted the computers active user account not the default path that i have defined.

I have tried various ways to not have that happen, including implementing a first run check of the application that forces the user to check and apply settings.

which thought was working, but after the first run, shutting the program down and starting it again the user was forced to go and reset the settings to the default values manually even though the previous run the settings were saved and verified that they were saved the settings on the second run reverted to the machines active user pathing to instead of:


the settings are being reverted to:


does anyone have any ides as to why this happens?

i want to allow my users to be able to customize these settings but at the same time be able to install and run the app and use it without having to worry about settings if they do not want to.

Cheers, any help would be great.
Kschuler 13-Dec-10 12:08pm
What kind of setting are you using, just a string? Are you setting the default value by just entering it on the settings screen? Maybe leaving it blank and coding the program to set the default would work better? Is the scope of your settings on Application or User?
Roland71 13-Dec-10 12:16pm
Setting type: String
Scope: User

default are set by initially entering into settings screen however as i mentioned i put in a firtrun detection which sets the settings in code to the desired default paths then call the: My.Settings.Save() method. But as i said, this makes no difference at all, because as soon as the user shuts down the program and then goes back to it later the settings have been reverted back to the user documents folder rather than the Public documents folder. Forcing the user to reset the paths once again, after that it is fine and stays at the Public Documents.

It is a bit madding. Driving me crazy.

I am one step away from creating my own settings provider.

1 solution

Your issue is scope of the setting values and not using them correctly.

A setting value can have one of two scope settings Application or User, now if you set the scope to Application these settings are common for all users on that computer so if you change it for one it changes for all users. Now if you set the scope to User what happens is a section called userSettings is placed in the config file which is in the install directory of the app when a user starts the app it checks for a copy of these settings in the [username] directory and if there isn't one it makes a copy from the main config file using the defaults specified there and the copy is what is changed on a per user basis.

What you need to do is stop trying to override the default behaviour as the Public directory should only be used for application wide config settings not User config settings.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900