Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Keeping settings across versions?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sin Jeong-hun - 01 Mar 2008 05:14 GMT
I used the settings class that VS.NET automatically generates to save
some app settings, simply because it is the easiest way. But the
problem is, even though the settings class wasn't changed (no fileds
are modified) each time I change my app's version slightly (like 0.1.0
to 0.1.1) all the settings are gone. Is it possible to keep settings
across versions as long as teh settings class isn't modified?
Sin Jeong-hun - 14 Mar 2008 15:32 GMT
> I used the settings class that VS.NET automatically generates to save
> some app settings, simply because it is the easiest way. But the
> problem is, even though the settings class wasn't changed (no fileds
> are modified) each time I change my app's version slightly (like 0.1.0
> to 0.1.1) all the settings are gone. Is it possible to keep settings
> across versions as long as teh settings class isn't modified?

There's no way to avoid this? It's really annoying that all settings
are gone if I change the version slightly (like 1.0.0-> 1.0.1). Do I
have to create my own way to save and load settings instead of using
VS.NET's built-in settings architecture? Please give me any advice.
Rob Lancaster - 14 Mar 2008 16:40 GMT
>> I used the settings class that VS.NET automatically generates to save
>> some app settings, simply because it is the easiest way. But the
[quoted text clipped - 7 lines]
>have to create my own way to save and load settings instead of using
>VS.NET's built-in settings architecture? Please give me any advice.

Have a look at ApplicationSettingsBase.Upgrade()

http://msdn2.microsoft.com/en-us/library/system.configuration.applicationsetting
sbase.upgrade.aspx


Rob
Sin Jeong-hun - 18 Mar 2008 22:17 GMT
On Mar 15, 12:40 am, "Rob Lancaster" <robert.lancaste...@ntlworld.com>
wrote:

> >> I used the settings class that VS.NET automatically generates to save
> >> some app settings, simply because it is the easiest way. But the
[quoted text clipped - 13 lines]
>
> Rob

Thank you. I guess Upgrade() should be called once the version has
chaged, and there seems to be no way to get whether the settings file
for this version of the application is just created or not (i.e. first
run), I added an entry "FirstRun" with default value = true and added
the following code at the beginning of the application.

    if (Properties.Settings.Default.FirstRun)
    {
        Properties.Settings.Default.Upgrade();
        Properties.Settings.Default.FirstRun = false;
    }
Now everything seems to work as I expected.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.