473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

.NET ini equivalent

guy
I've come across a general XML file that can be used for reading application
specific parameters to store from one running to another (for example last
screen position) but can't remember where I found it. Can someone please
remind me what the XML file is called and the class/namespace used to
manipulate it? It's the .NET replacement for using INI files.

Also is this the standard way to store information such as last used
directory for certain tasks etc. or what is the standard? Registry?

Thanks
Nov 16 '05 #1
6 2943
It is the file called MyApplication.exe.config.

To create it with Visual Studio, you can do "Add Item..." to your project
and choose "Configuration file". This will create a file called App.config.
When you compile your projet, the App.config file will be copied to
bin\Debug and renamed MyApplication.exe.config. The format of the file is
described in the online doc (search for configuration).

Bruno.

"guy" <wi*********@hotmail.com> a écrit dans le message de news:
ut**************@TK2MSFTNGP11.phx.gbl...
I've come across a general XML file that can be used for reading
application specific parameters to store from one running to another (for
example last screen position) but can't remember where I found it. Can
someone please remind me what the XML file is called and the
class/namespace used to manipulate it? It's the .NET replacement for using
INI files.

Also is this the standard way to store information such as last used
directory for certain tasks etc. or what is the standard? Registry?

Thanks

Nov 16 '05 #2
HiBruno Jouhier [MVP],
It is the file called MyApplication.exe.config.


You forgot to mention, that you only can *read* from that file!

The OP also wants to save some settings...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 16 '05 #3
guy
That rang the bell and I remember using that file on a project some while
back. Can't you write from the app to that file? I thought you could.

Thanks guys
"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn*********************************@207.46.24 8.16...
HiBruno Jouhier [MVP],
It is the file called MyApplication.exe.config.


You forgot to mention, that you only can *read* from that file!

The OP also wants to save some settings...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 16 '05 #4
No, you can only read settings from this file!

So you have to create your own setting file (and place it somewhere in the
Documents and settings\...\Application Data area rather than under Program
Files, to follow the MS guidelines). You can use XML serialization to
serialize your settings (easy and extensible).

Bruno.

"guy" <wi*********@hotmail.com> a écrit dans le message de news:
%2****************@TK2MSFTNGP10.phx.gbl...
That rang the bell and I remember using that file on a project some while
back. Can't you write from the app to that file? I thought you could.

Thanks guys
"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn*********************************@207.46.24 8.16...
HiBruno Jouhier [MVP],
It is the file called MyApplication.exe.config.


You forgot to mention, that you only can *read* from that file!

The OP also wants to save some settings...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/


Nov 16 '05 #5
Hi guy,

Adding on to what everybody said, the application will read the
configuration settings only during the initial load. You will not be able to
re-load the settings from app.config after the application has been loaded -
you will have to restart the application.

The ConfigurationSettings class allows you to only read the settings. No
direct facility is provided by the framework to write to it. But this won't
be much tough to implement.

The foto Vision sample @ windowsforms.net has a settings writer which writes
to the file. Maybe you could get the sample and go thru the code for doing
this. The link is:
http://www.windowsforms.net/Applicat...=50&tabindex=8

HTH,
Rakesh Rajan

"guy" wrote:
That rang the bell and I remember using that file on a project some while
back. Can't you write from the app to that file? I thought you could.

Thanks guys
"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn*********************************@207.46.24 8.16...
HiBruno Jouhier [MVP],
It is the file called MyApplication.exe.config.


You forgot to mention, that you only can *read* from that file!

The OP also wants to save some settings...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/


Nov 16 '05 #6
guy
Thanks Rakesh,

So what is the standard for saving application settings when exiting an
application. For example if the user changes settings in the Tools ->
Options dialog and you want to restore the settings to the user's
preferences on next application startup. Is there a documented MS or other
standard that says where theses settings should be stored.

Thanks.
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
Hi guy,

Adding on to what everybody said, the application will read the
configuration settings only during the initial load. You will not be able
to
re-load the settings from app.config after the application has been
loaded -
you will have to restart the application.

The ConfigurationSettings class allows you to only read the settings. No
direct facility is provided by the framework to write to it. But this
won't
be much tough to implement.

The foto Vision sample @ windowsforms.net has a settings writer which
writes
to the file. Maybe you could get the sample and go thru the code for doing
this. The link is:
http://www.windowsforms.net/Applicat...=50&tabindex=8

HTH,
Rakesh Rajan

"guy" wrote:
That rang the bell and I remember using that file on a project some while
back. Can't you write from the app to that file? I thought you could.

Thanks guys
"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn*********************************@207.46.24 8.16...
> HiBruno Jouhier [MVP],
>
>> It is the file called MyApplication.exe.config.
>
> You forgot to mention, that you only can *read* from that file!
>
> The OP also wants to save some settings...
>
> --
> Greetings
> Jochen
>
> My blog about Win32 and .NET
> http://blog.kalmbachnet.de/


Nov 16 '05 #7

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

Similar topics

14
by: John | last post by:
Is there an equivalent of COM on Linux that I can get through Python. My need is to have some sort of language independent component framework. I can think of CORBA but I have to have a server...
2
by: Michael Foord | last post by:
Please pardon my ignorance on this one - but I'm not certain how the sign bt is treated in python bitwise operators. I've trying to convert a javascript DES encryption routine into python. ...
3
by: Robert Dodier | last post by:
Hello, Here's a thought that I'm sure has already occurred to someone else, I just can't find any record of it yet. An XML document is just a more verbose and clumsy representation of an...
1
by: Vannela | last post by:
Is there any equivalent control in .NET for the Power builder DataWindow control? I am explaining the Datawindow architecture to some extent. Power Builder DataWindow Control has got different...
6
by: Frank Rachel | last post by:
So I can focus on the correct areas of research, I was wondering if someone could give me the .NET equivelents for this J2EE architecture: JSP's make calls to local JavaBean Controls. The...
3
by: Marty | last post by:
Hi, What is the VB.NET equivalent of the VB6 ADODB.Connector and ADODB.Recordset? Thanks Marty
7
by: Tim Conner | last post by:
Hi, I am an ex-delphi programmer, and I having a real hard time with the following simple code (example ): Which is the equivalent to the following code ? var chars : PChar; sBack, s :...
10
by: karch | last post by:
How would this C# contruct be represented in C++/CLI? Or is it even possible? PolicyLevel level = (enumerator->Current) as PolicyLevel; Thanks, Karch
9
by: Alan Silver | last post by:
Hello, I'm converting some old VB6 code to use with ASP.NET and have come unstuck with the Asc() function. This was used in the old VB6 code to convert a character to its ASCII numeric...
14
by: grid | last post by:
Hi, I have a certain situation where a particular piece of code works on a particular compiler but fails on another proprietary compiler.It seems to have been fixed but I just want to confirm if...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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,...

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.