Reputation: 21
Basically, I had just use some coding to convert all the password to hash and have save these hash into a textfile.
The next thing that I wanted to do is to read the textfile and saved it into the application. I have already do some research on how to read a textfile and add it into my code, but my main concern is where do I save it into so that it will be stored into the application?
Upvotes: 2
Views: 126
Reputation: 2528
The problem that you are facing is simply this; Each time that you 'release' a version of your program the settings stored in My.Settings are tied to the version number of that release. Typically they'll be stored in the AppData|Local|[Your CompanName]|[Your Application Name]|[Application Version Number].
Every time you release a new version a new settings folder gets created and it will typically use the default settings that you placed in My.Settings, so everything that your end user set in the last version gets lost on upgrade.
Now on the face of it you'd think that that would render My.Settings pretty useless, and indeed if you don't allow for that it does, but fortunately there is a little trick you can employ that gets around this. My.Settings has a special little method to help you with this called Upgrade
So how do you use this little trick?
NB: I've had to add the code snippet as a picture because for some reason the code formatter that SO uses doesn't like the # symbol.
So essentially what you are doing here is only calling this routine when your application is running in release mode. If it's a brand new version of your application it see's (from the fact that your special setting 'SettingsUpdateRequired' that an upgrade is required. The old settings that your end user had in the last version are then transferred over to the new version and the 'SettingsUpdateRequired' value is then set to false and saved. My.Settings.Upgrade won't run again until you release a new version and your end user has their own personalised settings retained.
Upvotes: 2