|
-
Apr 13th, 2010, 03:39 AM
#1
Thread Starter
Lively Member
[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?
Thanks for any input for this noob.
Best regards,
Leon
-
Apr 13th, 2010, 06:35 AM
#2
Re: Using new my.settings after application restart
Have you tried to use the My.settings Reload or Reset when starting the application to see if it gets the new values?
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Apr 13th, 2010, 09:16 AM
#3
Thread Starter
Lively Member
Using new my.settings after application restart
Hi Micky_pt,
Thanks for the quick reply.
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.
Thanks again,
-
Apr 14th, 2010, 03:25 AM
#4
Thread Starter
Lively Member
Using new my.settings after application restart
Hi Micky_pt,
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.
Thanks and best regards,
Leon
-
Apr 14th, 2010, 04:39 AM
#5
-
Apr 14th, 2010, 05:10 AM
#6
Thread Starter
Lively Member
Re: Using new my.settings after application restart
Hi Mickey_pt,
I'm indeed running from the IDE, not the .exe.
I'll try and post the results here again.
Thanks for the continued help you're offering.
I really hope that it's this simple, but feel a bit stupid if it is.
Best regards,
Leon
-
Apr 14th, 2010, 07:34 AM
#7
Re: Using new my.settings after application restart
You can also manually save the settings by calling My.Settings.Save()
-
Apr 17th, 2010, 12:42 AM
#8
Thread Starter
Lively Member
Using new my.settings after application restart
Hi Mickey_pt,
Took a bit longer to try this time, but it works a dream.
A bit strange behavior of the IDE, I never even thought of looking there for being the cause of my problem.
Again, thank you very much for your kind help.
Best regards,
Leon
-
Apr 14th, 2012, 04:01 AM
#9
New Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|