?
Solved

Loading application settings from a file.

Posted on 2011-10-29
6
Medium Priority
?
289 Views
Last Modified: 2012-05-12
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.

0
Comment
Question by:mmosoul
6 Comments
 
LVL 40
ID: 37050057
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.
0
 
LVL 2

Expert Comment

by:supengmmer
ID: 37050076
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!
0
 

Accepted Solution

by:
mmosoul earned 0 total points
ID: 37050323
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 40
ID: 37050384
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.
0
 
LVL 8

Expert Comment

by:Wiesje
ID: 37052509
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?
0
 

Author Closing Comment

by:mmosoul
ID: 37634013
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question