?
Solved

Best technique for persisting program options

Posted on 2007-04-05
2
Medium Priority
?
215 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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 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