Loading application settings from a file.

I am trying to load a config file from my server to set the application settings but when my program launches it still has the default settings in it.  The settings are being loaded but it appears they are being overwrote by the defaults after that.  When is the application settings loaded by the file?  I have tried placing a timer to load my file after the program finishes loading.  I tried placing my load config on my login form(the timer opened it after a 15 second delay).  Neither option made any effect.

Who is Participating?
mmosoulConnect With a Mentor Author Commented:
I have buttons to change the settings anywhere through my program, they all change the settings and it saves.  Why does it have to be in the application folder?  It's reading a text file and changing the values.  I want to read this file and have it change the values after the program loads so I can make changes and have them effects all clients when they load.  I can add a button to call this function and the values change.  This function is called long after the first line of the program so if the client side file is loaded before the first line of the program then it makes absolutely no sense as to why it's not working.
Jacques Bourgeois (James Burger)PresidentCommented:
Unless you create your own class to read it, the .config file must be located in the application folder, and it is read before your first line of code executes.

If you need to get it from the server each time the application start, the only way I see would be to have a launcher application.

You launch the launcher.
It copies the .config file from the server to the local directory.
It then launch the application.
After you  load the config ,you assign  the valus in the config  to program's variables. Then it can run rightly  according to those variables.
Since you say the settings have been loaded , then I think the wrong link is the assign process.You try to  debug it. come on!
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Jacques Bourgeois (James Burger)PresidentCommented:
My.Settings, as any other feature in the My environment, has been designed to simplify things for VB developers. It has been designed mostly for amateurs. A great time saving, but that does not offer you complete control over things. My.Settings has thus been designed to work with a config file located in the application directory, because this is what most programmers do.

If you want to customize the way you handle the settings, you will have to either devise your own system, or modify the standard behaviour by writing your own code around the classes that you will find in the System.Configuration namespace.
Another point to note: would it be possible that you are setting the default settings in the code somewhere... as in after the settings have been read in?
mmosoulAuthor Commented:
I can find no reason for anything I tried to not work.  I can change the settings by clicking a button after my program is loaded, I should be able to do the same thing in the program.  I even had my program click the button that I click with the mouse but....after exhausting all resources I have abandoned the idea.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.