Solved

Best technique for persisting program options

Posted on 2007-04-05
2
201 Views
Last Modified: 2010-04-15
I'm using VS2005 C#.  I have a custom data grid that holds many date values.  If any date is within so many days from the current date, that cell is colored a specific color (such as yellow).  If any date on the grid is earlier than the system date that cell is colored a specific color (such as red).  The person using the program will determine their own color key,and their color key will be persisted with the data grid.  If the program is started for the first time, and there are no open files, there still has to be a default color key that comes with the program.  

My question is this:  what is the best way to persist the default color key.  Should it be in the registry or as a runtime class or some other method?
0
Comment
Question by:fly412s
2 Comments
 
LVL 10

Expert Comment

by:Si_Hibbard
ID: 18862805
I would probably use an xml file to store app settings. Maybe this will help - example of using xml and datasets.

http://www.codeproject.com/dotnet/XMLSettingsFile.asp
0
 
LVL 9

Accepted Solution

by:
ripahoratiu earned 500 total points
ID: 18862870
The best way would be to have it coded into your application as follows:
1. I'm assuming that you've extended the datagrid and you have 2 properties Colour1 and Colour2
2. After putting the control in a form or whatever, set the two properties into Property Pane: in Data -> ApplicationSettings, PropertyBinding and search there for them. You can set the default value and the scope (per user or per application). Once you've set them check that the value of the properties are updated on any change in the XML repository (in designer DataBindings.Add(new System.Windows.Forms.Binding .... has the last parameter System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)
3. Save the Apllication setting once you leave the form, or anytime the user modifies the colour.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now