473,396 Members | 2,147 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,396 software developers and data experts.

how to use ApplicationSettingsBase

Hi,

I try to do something with ApplicationSettingsBase but after save I cannot
find a config file, and it does not load eather. Probably I forget somethign
but what ? Can someone check this ? I assume (according to the help) that
after clicking button2 I have a config file in application's folder, but I
have not.

Also I get an exception error if using [UserScopedSetting]. Wy ? There is
some explanation of this in the help, but (my poor) english does not
understeand it completely :(

namespace WindowsApplication1
{
partial class Form1: Form
{
MySettings cfg = new MySettings();

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add(cfg.MyValue.ToString());
listBox1.Items.Add(cfg.MyFormColor.ToString());
cfg.MyValue = 567;
cfg.MyFormColor = System.Drawing.Color.Bisque;
}

private void button2_Click(object sender, EventArgs e)
{
cfg.Save();
}
}

public class MySettings: ApplicationSettingsBase
{
[ApplicationScopedSetting]
[DefaultSettingValue("123")]
public int MyValue
{
get { return (int)this["MyValue"]; }
set { this["MyValue"] = value; }
}

//[UserScopedSetting]
[ApplicationScopedSetting]
[DefaultSettingValue("Blue")]
public Color MyFormColor
{
get { return (Color)this["MyFormColor"]; }
set { this["MyFormColor"] = value; }
}
}
}

--
rgds, Wilfried
http://www.mestdagh.biz
Nov 16 '05 #1
0 4082

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

Similar topics

5
by: Doug Handler | last post by:
Does anyone know how to access the Settings property information? VS2k5 created this, all documentation basically only points to VB.NET. When you try it in C#, nothing is accessible. Any...
0
by: tomislav.bartolin | last post by:
Hi, I have inherited TaskSettings class from the ApplicationSettingsBase class and are able to get the configuration settings for this class quite nicely in my windows app. Now, if I inherit...
5
by: Mountain | last post by:
In the following MSDN documentation: http://msdn2.microsoft.com/en-us/library/system.configuration.applicationsettingsbase(VS.80).aspx there is an example of using ApplicationSettingsBase. I...
5
by: Mountain | last post by:
I'm working with the example code found at http://msdn2.microsoft.com/en-us/library/system.configuration.applicationsettingsbase(VS.80).aspx. I would like to implement application settings based...
3
by: xycos | last post by:
Hello. I apologize for asking this question as the information I need is availible via the MSDN library, however I cannot seemt o understand what I need to do, so I'm asking here. I have created...
13
by: Dave | last post by:
When using the properties designer to store application wide properties how do you get this to work across a project group containing an EXE and a collection of DLLs. I'm using C#.Net 2005. I...
1
by: Andreas Cieslik | last post by:
Hello, What is the best and professional way to deploy a DLL that consumes the customers webservice url instead of my coded webservice url of my local test system? Is there a way to keep it...
1
by: gilbert | last post by:
Hello. I am trying to work with the Settings in .NET 2.0. I have a few settings in the VS2005 generated ApplicationSettingsBase class (Properties.Settings.settings). These settings are marked...
3
by: =?Utf-8?B?ZmJvbGVmZXlzb3Q=?= | last post by:
I have a 'Filter' class that contains some strings, 1 bool and 2 Color attributes. I made an array of Filter : Filter, and I'd like to save this array with the application settings system. here...
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: 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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.