Results 1 to 9 of 9

Thread: [RESOLVED] Using new my.settings after application restart

  1. #1
    Lively Member
    Join Date
    May 06
    Posts
    77

    Resolved [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

  2. #2
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 06
    Location
    Corner of the Europe :)
    Posts
    1,923

    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

  3. #3
    Lively Member
    Join Date
    May 06
    Posts
    77

    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,

  4. #4
    Lively Member
    Join Date
    May 06
    Posts
    77

    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

  5. #5
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 06
    Location
    Corner of the Europe :)
    Posts
    1,923

    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.
    Attached Files Attached Files

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  6. #6
    Lively Member
    Join Date
    May 06
    Posts
    77

    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

  7. #7
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 08
    Location
    On the Internet
    Posts
    2,845

    Re: Using new my.settings after application restart

    You can also manually save the settings by calling My.Settings.Save()

  8. #8
    Lively Member
    Join Date
    May 06
    Posts
    77

    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

  9. #9
    New Member
    Join Date
    Apr 12
    Posts
    9

    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
  •