473,480 Members | 2268 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows Forms application configuration

Is there a 'best practice' methodology for storing and retrieving
configuration data in C# Windows Forms applications? I'm talking about the
sort of stuff that went into INI files in the old days.

I'm planning to create a class to hold initialization information, then
serialize the class to the application directory to persist it. Any better
way to get the job done? Thanks

Dave Veeneman
DNL Systems
Nov 16 '05 #1
3 1521
Adding a .NET config file works pretty well although you can't write to it
from within your app. If you use the .configs then you can have designer
support for dynamic properties and it's very easy to access the values. I
believe MS recently put out a Configuration application block as well that
may be helpful.
"Dave Veeneman" <da****@nospam.com> wrote in message
news:uf**************@TK2MSFTNGP09.phx.gbl...
Is there a 'best practice' methodology for storing and retrieving
configuration data in C# Windows Forms applications? I'm talking about the
sort of stuff that went into INI files in the old days.

I'm planning to create a class to hold initialization information, then
serialize the class to the application directory to persist it. Any better way to get the job done? Thanks

Dave Veeneman
DNL Systems

Nov 16 '05 #2
JD
For now, you pretty much have to "roll your own". There are a number of
online articles, many of which suggest the same thing you're planning to do.
Check www.codeproject.com, as I recall seeing at least one there.

William's suggestion of .config for the app is fine if you're just reading
from the file at runtime. The framework doesn't have built-in support to
write/modify the file. There are articles/samples that show you how to do
that, but it's not terrribly safe -- if your app is in Program Files, a
standard "user" account won't have write/change privileges. You can use the
Environment type or Isolated Storage (either way) to store it in a
user-specific, permissions-safe location.

JD

"Dave Veeneman" <da****@nospam.com> wrote in message
news:uf**************@TK2MSFTNGP09.phx.gbl...
Is there a 'best practice' methodology for storing and retrieving
configuration data in C# Windows Forms applications? I'm talking about the
sort of stuff that went into INI files in the old days.

I'm planning to create a class to hold initialization information, then
serialize the class to the application directory to persist it. Any better way to get the job done? Thanks

Dave Veeneman
DNL Systems

Nov 16 '05 #3
Dave Veeneman wrote:
Is there a 'best practice' methodology for storing and retrieving
configuration data in C# Windows Forms applications? I'm talking
about the sort of stuff that went into INI files in the old days.

I'm planning to create a class to hold initialization information,
then serialize the class to the application directory to persist it.
Any better way to get the job done? Thanks


There's a nice article on MSDN describing several ways to store
configuration data.

http://msdn.microsoft.com/library/de...appsettnet.asp

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7262
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
1
1764
by: Günther Rühmann | last post by:
Hi, I´m not sure if i´m right int this group... My problem: I made a vb .net application that reads from AD via System.Directoryservices.Directoryentry. The appliocation enumerates group...
9
2128
by: Günther Rühmann | last post by:
Hi, I´m not sure if i´m right int this group... My problem: I made a vb .net application that reads from AD via System.Directoryservices.Directoryentry. The appliocation enumerates group...
7
1532
by: G. Schmelzer | last post by:
Hi Ng, I've got a problem with the debugging of a Windows Application. I start the app in Debug Mode. But when an exception appears, vs.net doesen't jump to code line where the exception...
1
3951
by: harinathch | last post by:
Hi, Iam working with myapplication.exe.config file in my vb.net windows application.Its working fine in my development environment. When i test this application in some other machine using exe and...
4
4152
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
2
2372
by: Budhi Saputra Prasetya | last post by:
Hi, I managed to create a Windows Form Control and put it on my ASP .NET page. I have done the suggestion that is provided by modifying the security settings. From the stack trace, I would...
0
2041
by: Budhi Saputra Prasetya | last post by:
Hi, I still have the same problem with embedding Windows Control. I'll just requote what I posted last time: I managed to create a Windows Form Control and put it on my ASP .NET page. I...
2
11684
by: sambo251 | last post by:
After running a few updates I get this very annoying "Windows Installer" error #1706 that will ne go away! It keeps saying that it cannot find the file "instantsharedevices.msi", that it is on...
3
4273
by: shobhitguptait | last post by:
How to Run C#.NET Windows App on N/W with centralized DB using SQL SERVER 2000 Hello All...i m really grate full to c such a website where developers try to help people like us who face problems...
0
7054
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6918
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5357
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4495
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3008
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1310
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.