How to update application settings in vb.net code




















The my. I want the user to be able to modify some of the application setting like my connection strings through a friendly user interface on one of my forms, without having to go in the. If its in my code I can do testing and validating when he chages things. Any help appreciated Bob.

Follow Post Reply. Hi, If you go to the project properties and click the settings tab, you can define my. In the scope column you can specify if the setting is an application or user setting. I have never tried the above solution, but I remember reading it somewhere in msdn.

Cheers, Ahmed Bob wrote: The my. Thanks, I know that, the problem is that if you scope the settings to application, you can't modify them from within code, they seem to be read only and you can only access them via notepas in te app. Since when I distribute my application, duing its lifecycle, things like connection strings are liable to change, I want to give the user the ability to configure these and other settings from within the app.

I am asking because at that stage the user. I got this puzzle in this example. I set the of NewInstallation to True. Then after installation, the value is set to False and saved, sothat when the app runs it always detect a False value for NewInstalltion. However, wwhen I install the project it does detect NewInstallation to be True on the fiirst installation. When you remove the app and re-install, it always detect a False value for NewInstallation and therefore crashes.

It seems to me that on subsequent installations, the. EXE file no longer reads from the App. Please explain this puzzle. If this is the case, one has to delete the user. If this is the only solution, how then does one delete the user. Thanks for clarifying this for me. Mike — Reinstalling should not change the method your application uses to retrieve settings or cause the errors you are experiencing. However, I have not tested this before and am very intrigued by your findings.

Unfortunately I do not have time at the moment to research your question but would appreciate you posting again should you learn more about this. User settings in a corporate context for me would typically be stored in a database table.

So I often revert to simpler, more straightforward techniques such as:. Be sure you save with schema such as …. Datatables are great because you can easily loop through the rows, have as many values per row as needed and even pass single rows to methods as a DataRow.

You can retrieve this file into an array of strings with single line such as…. This is so easy to read and write to. Microsoft wanted to create a generic and universal approach to saving data and it does work but can often require much time to learn all the nuances.

But if your needs are simple, then designing your own approach that you have complete control over. To overcome the problem of losing all settings when updating the software you can use the My. Upgrade which reloads User settings from a previous version. I added the following code into the Sub New section of my application: — If My. Settings instance. Upgrade My. Save End If.

MyApplicationSetting, but if you use the format My. Thank you very much for this post, there is a lot of mis-information on this topic but this post is the most simple and most effective. Luckily, I managed to key in the right keywords into Google to find this blog. I am developing the web application in vb. Actullay i have a problem with lables highlighitng. My qns is if user has selected one field as highlighted ,once the user logged off and loggig into that application, still user see that the label should be highlighted.

How can we start to write the code for this? Great post. I have a question about user settings: If we have multiple. I can iterate through Properties. I wish I would have read this first.

Nice info on the User Settings. My problem is that as long as the application is running, the user settings persist. But, after a few builds when developing.

The User. Will this happen when users install it, will they have to keep resetting the properties? Be sure to sync configurations in Visual Studio, especially if you rebuilt with a new version number as they are version specific.

Users will always load the correct config for their version…that is my understanding. NET framework has a very nice Settings feature built-in. This site uses Akismet to reduce spam. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Update appSettings from code behind Ask Question. Asked 8 years ago. Active 8 years ago. Viewed 2k times.

EventArgs Handles btnSaveDefault. Item "Default". Text config. Save ConfigurationSaveMode. Modified ConfigurationManager. Settings Object. For this example to work, your application must have a Nickname setting, of type String. For more information, see Managing Application Settings. Skip to main content. This browser is no longer supported.



0コメント

  • 1000 / 1000