My application is being developed in VS2008.
Target frame work is .Net 2.0
This is a Desktop application.

My application collects some information from User, Name of company address etc. Those are to be included in the report I am generating.

I need to save these information and some other settings like Window size etc. So that it will be loaded in the next run. No different 'users' in my application(Other than OS users), only one settings needed.

From searching I concluded that at least two methods are possible. One is config files available through application settings tab in project properties, another is by making a .ini file.

If it was program settings only I think the config method will be ok, but since I need to store information like strings which the user may enter and update in the course of time. I am more interested in creating a file like ini file which can be read and updated by the application. (Any links to examples for this?).I am looking for a mechanism to save different types of persistent data which I can later adapt to my requirements.

But while searching I found that in future OS, users may not have privileges to write or update files into program folders where application is running. Presently I am storing my other data files (Which are text files) in a sub folder in application directory.

What is the appropriate method for my requirement? Which way I should proceed?

Thank you

Recommended Answers

All 2 Replies

You can also use the configuration file like you mentioned. You should have a "Settings.settings" file in the Properties\ directory of your solution. Add a new string value (leave the default value empty), then to get/set/save the config file:

Properties.Settings.Default.adminusername = "lastlogin";
      Properties.Settings.Default.Save();

In the example above adminusername is the property in my Settings.settings.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.