473,246 Members | 1,557 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,246 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 3568
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
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.