[RESOLVED] Using new my.settings after application restart
Dear All,
I'm still a very new to vb2008, coming from vb6. I've been searching my head off, trying to find a solution but can not find it.
The problem is as follows.
I'm using my.settings to store different communication parameters. After changing parameters, for several reasons, it's easier to restart the application then to re-initialize all objects/variables/etc using program code.
When I change my.settings and use save to save them. When I quit the application and manually start it again, the newly saved settings are used.
When I use either .restart, or application.exit in combination with process.start. The application will use the old values for my.settings.
If I read up on .restart there's a remark mentioning that it will restart the application using the initially used settings.
Before restarting the application, I manually checked if the new settings were really save to the user.config file, and they were.
My question:
Is there a way to restart the application using either .restart, or application.exit in combination with process.start which will use the newly saved my.settings values?
I tried reload after I had saved the new settings and just before restarting. I've not yet tried reset, nor have I tried them when restarting the application.
The information I found to date always suggested to do this before restarting the application.
I'm gonna try your suggestion in the load event of the main form and post the results here.
I've now tried it both. First I tried using my.settings.reload then using my.settings.reset in the load event of the main form. Restarting the application I used either .restart, or application.exit in combination with process.start.
Unfortunately to no avail. In all 4 possible setups, after restart, the application used the old my.settings values.
If there's anyone whom might have another suggestion, I would appreciate any input on this frustrating issue.
Re: Using new my.settings after application restart
Are you runing the code directly from the IDE? If you're that's the problem...
I attached a small project showing the problem, first try to run the code directly from the IDE and then run the code directly from the EXE...
The problem exists because the settings are saved in UserProfile and if you run in the IDE it will pick up the default setting from the application folder.
Rate People That Helped You Mark Thread Resolved When Resolved
Re: [RESOLVED] Using new my.settings after application restart
Hi, Mickey_pt
I'm already try your code but still it can't solve my problem.
yes..when i use application.restart my.setting value is correct now.
But when i close the program manually, and then i start the program again without using application.restart, my.setting value is not the new one but the old one now..
it's the opposite from the problem that droopy928gt post.