473,385 Members | 1,492 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,385 software developers and data experts.

How to access default user settings ?

I developed a Win form with VS.NET 2005 + .NET 2.0 in C#
There are some application settings are "User" scope and stored in
xxx.settings,
I can access them via Settings class and changethem with Settings.Save();
However, if I change and save them then my app will read the change from
the user.config , my question is how to access the original default setting?
Jan 24 '07 #1
4 3573
They are in the application.exe.config file, in the "userSettings" section.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

In case of Minimalism, break Philip Glass.

"RedHair" <re*****@u.s.awrote in message
news:OS**************@TK2MSFTNGP05.phx.gbl...
>I developed a Win form with VS.NET 2005 + .NET 2.0 in C#
There are some application settings are "User" scope and stored in
xxx.settings,
I can access them via Settings class and changethem with Settings.Save();
However, if I change and save them then my app will read the change from
the user.config , my question is how to access the original default
setting?


Jan 24 '07 #2
Yes, I know.
Is there any class is able to access them directly?
"Kevin Spencer" <un**********@nothinks.comwrote in message
news:OH**************@TK2MSFTNGP02.phx.gbl...
They are in the application.exe.config file, in the "userSettings"
section.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

In case of Minimalism, break Philip Glass.

"RedHair" <re*****@u.s.awrote in message
news:OS**************@TK2MSFTNGP05.phx.gbl...
>>I developed a Win form with VS.NET 2005 + .NET 2.0 in C#
There are some application settings are "User" scope and stored in
xxx.settings,
I can access them via Settings class and changethem with Settings.Save();
However, if I change and save them then my app will read the change from
the user.config , my question is how to access the original default
setting?



Jan 24 '07 #3
No, there is nothing ready-made to do this. If you use the Visual Studio
Project Settings to create the Application Settings, what it does is to
create both a Configuration file and a class that inherits
System.Configuration.ApplicationSettingsBase. The class is used in an
application to retrieve values in the Application Configuration file.
Settings are defined as being Application-scoped or User-scoped via
attributes, as well as the default values for User Settings, with the
System.Configuration.DefaultSettingValueAttribute. So, since the default
values are not exposed as properties in the class, you would have 2 possible
ways to get at them:

1. Use reflection on the class to get the values of the attributes.
2. Write your own custom Application Settings class.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"RedHair" <re*****@u.s.awrote in message
news:u8**************@TK2MSFTNGP02.phx.gbl...
Yes, I know.
Is there any class is able to access them directly?
"Kevin Spencer" <un**********@nothinks.comwrote in message
news:OH**************@TK2MSFTNGP02.phx.gbl...
>They are in the application.exe.config file, in the "userSettings"
section.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

In case of Minimalism, break Philip Glass.

"RedHair" <re*****@u.s.awrote in message
news:OS**************@TK2MSFTNGP05.phx.gbl...
>>>I developed a Win form with VS.NET 2005 + .NET 2.0 in C#
There are some application settings are "User" scope and stored in
xxx.settings,
I can access them via Settings class and changethem with
Settings.Save();
However, if I change and save them then my app will read the change from
the user.config , my question is how to access the original default
setting?




Jan 25 '07 #4
Thank you!
While creating the Settings.settings with VS.NET 2005, there is also a
app.config file?
I should add *.settins or *.config file to read/write application settings?

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:uz**************@TK2MSFTNGP06.phx.gbl...
No, there is nothing ready-made to do this. If you use the Visual Studio
Project Settings to create the Application Settings, what it does is to
create both a Configuration file and a class that inherits
System.Configuration.ApplicationSettingsBase. The class is used in an
application to retrieve values in the Application Configuration file.
Settings are defined as being Application-scoped or User-scoped via
attributes, as well as the default values for User Settings, with the
System.Configuration.DefaultSettingValueAttribute. So, since the default
values are not exposed as properties in the class, you would have 2
possible ways to get at them:

1. Use reflection on the class to get the values of the attributes.
2. Write your own custom Application Settings class.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"RedHair" <re*****@u.s.awrote in message
news:u8**************@TK2MSFTNGP02.phx.gbl...
>Yes, I know.
Is there any class is able to access them directly?
"Kevin Spencer" <un**********@nothinks.comwrote in message
news:OH**************@TK2MSFTNGP02.phx.gbl...
>>They are in the application.exe.config file, in the "userSettings"
section.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

In case of Minimalism, break Philip Glass.

"RedHair" <re*****@u.s.awrote in message
news:OS**************@TK2MSFTNGP05.phx.gbl...
I developed a Win form with VS.NET 2005 + .NET 2.0 in C#
There are some application settings are "User" scope and stored in
xxx.settings,
I can access them via Settings class and changethem with
Settings.Save();
However, if I change and save them then my app will read the change
from
the user.config , my question is how to access the original default
setting?




Jan 26 '07 #5

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

Similar topics

1
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks...
1
by: zhangyuewuliu | last post by:
Hi, I have a DCOM Server and client running on the same box. I am using the custom security instead of default security and have opened up the server's custom access right to basically everyone. ...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
29
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ...
10
by: Eric E | last post by:
Hi all, I am using an Access client linked to a PG 7.4 server via ODBC. I have a stored proc on the server that inserts rows into a table.particular table, accomplished via an INSERT within the...
8
by: carriolan | last post by:
Hi I have an MS Access based application almost ready for distribution to the public and I find that even though I have compiled it into an MDE file, tables and queries can still be be imported if...
6
by: GS | last post by:
Hi, There is reference about accessing settings file in VB.NET but nothing about C#. How do I read settings in application settings file with C#? Thanks, G
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
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: 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...

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.