473,498 Members | 98 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wrapper class for programatically creating application settings

JnrJnr
88 New Member
I am creating a wrapper class that derives from the ApplicationSettingsBase class to programmatically create application settings for a windows form.
I got it right to save my setting but now I want to know where is this "file" or ".config file" stored so I can view all the settings I have created.

Expand|Select|Wrap|Line Numbers
  1. public class myUserSetting : ApplicationSettingsBase 
  2.         {
  3.             [UserScopedSetting()]
  4.             //[DefaultSettingValue("")]
  5.             public String newDir
  6.             {
  7.                 get
  8.                 {
  9.                     return ((String)this["newDir"]);
  10.                 }
  11.                 set
  12.                 {
  13.                     this["newDir"] = (String)value;
  14.                 }
  15.             }
  16.         }
  17.         myUserSetting mySetting;
  18.         private void Form1_Load(object sender, EventArgs e)
  19.         {
  20.             mySetting = new myUserSetting();
  21.                         MessageBox.Show("derectory = " + mySetting.newDir + "       Properties Count = " + mySetting.Properties.Count.ToString());
  22.         }
  23.  
  24. private void button1_Click(object sender, EventArgs e)
  25.         {
  26.             mySetting.newDir = //random directory I have selected
  27.             mySetting.Save();
  28.             MessageBox.Show("Directry = " + mySetting .newDir);
  29.         }
I know that when you create application settings through the designer you can actually go to the designer and change values, scope, and type etc. You can also see and change application settings values by clicking on app.config file in solution explorer. But where is it stored when done programmatically? Is this code right, am I on the right track?
The reason I want to do this programmatically is because I want the user to assign a Name(setting) and Value(C:\blah\blah\bah) to create new settings and save them in my application.
any help would be much appreciated
Dec 7 '10 #1
2 3490
GaryTexmo
1,501 Recognized Expert Top Contributor
I think the file goes in your user folder, which depends on the operating system for its location. Like, in XP it's something like:

c:\documents and settings\<user name>\application data (or maybe local settings)

For Vista and up, I think they change the structure a bit and put it in a c:\Users folder.

I think anyway, check it out?
Dec 8 '10 #2
JnrJnr
88 New Member
I found the location of the user.config files, it is in
C:\Users\name\AppData\Local\Microsoft\Project_name .exe_some_URL
I have used a different approach to saving my settings. Im not using the rapper class anymore
Thanx
Dec 27 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2867
by: Christian Christmann | last post by:
Hi, I need an STL list and was thinking of putting the list in wrapper class. The reason for my decision is that you can much better perform consistency checks. For instance, I need a...
1
2003
by: David Veeneman | last post by:
How do I persist properties bound to application settings in the VS 2005 Designer? I am binding form and control properties to application settings using VS 2005, as explained in MSDN: ...
2
2273
by: John Mullin | last post by:
We are having a problem which appears similar to a previous posting: http://groups.google.com/groups?hl=en&lr=&frame=right&th=d97f552e10f8c94c&seekm=OZw33z9EDHA.2312%40TK2MSFTNGP10.phx.gbl#link1 ...
3
18266
by: Nayan Mansinha | last post by:
Hi All How can I store an array of objects in my C# Application.Settings? I have CMyObject class for which an array is created: CMyObject arr = new CMyObject; arr = new CMyObject();...
2
2853
by: Christian Chrismann | last post by:
Hi, an application uses a wrapper class for an STL list. Basically, this template class provides the same functions (delete, append, find...) as an ordinary STL list. Additionally, there are...
7
3298
by: lord.zoltar | last post by:
I have a problem which I think can be solved by creating new Settings on the fly, but I'mnot sure if it's possible, or if a better solution may exists. Here's the situation: I have a project with...
2
5604
by: Johnny Jörgensen | last post by:
Can somebody explain hopw to store and restore settings values in .NET 2005? I read in MSDN that "The Application Settings feature of Windows Forms makes it easy to create, store, and maintain...
2
1711
by: Grant Schenck | last post by:
This seems like is should be straight forward but I'm just not getting it. I have a very simple class (see below) which I think should be XML serializable. I have this class defined in my simple...
11
10081
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have...
0
1307
by: rupesh796 | last post by:
I have VC++ MFC application.I have to use these VC++ form as a dll and creating a wrapper class for these dll in order to access in C# application.I am new to VC++.Any answer for this problem...
0
7124
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
7163
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,...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5460
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,...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4586
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.