I've read the "How to: Create Application Settings" article (http://
msdn2.microsoft .com/en-us/library/ms171565.aspx) on the MSDN. It
looked fine. But this code is only good when all the settings entries
are defined at the compile time. And I have to modify the class itself
each and everytime I need more entries. So, is it impossible to get/
save dynamic entries?
I mean, instead of,
MyUserSettings. Background=colo r;
color=MyUserSet tings.Backgroun d;
use this
MySettings["key"]=color;
color=MySetting s["key"];
where "key" can be any string. If "key" doesn't exist, then a new
entry for "key" is created.
I could create my own class from scratch, but I just wonder if I could
utilize the already exsiting ApplicatoinSett ingsBase class. Thank you. 2 4149
You could certainly do this since the configuration file is well-formed XML.
The problem is that when you have modified and resaved this file, your
application will not automatically reload it unless it is restarted. If it is
an ASP.NET web app, and you modify the web.config (same concept) this will
cause the application to restart, and you will lose all session, cache and
application state.
Does that help?
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Sin Jeong-hun" wrote:
I've read the "How to: Create Application Settings" article (http://
msdn2.microsoft .com/en-us/library/ms171565.aspx) on the MSDN. It
looked fine. But this code is only good when all the settings entries
are defined at the compile time. And I have to modify the class itself
each and everytime I need more entries. So, is it impossible to get/
save dynamic entries?
I mean, instead of,
MyUserSettings. Background=colo r;
color=MyUserSet tings.Backgroun d;
use this
MySettings["key"]=color;
color=MySetting s["key"];
where "key" can be any string. If "key" doesn't exist, then a new
entry for "key" is created.
I could create my own class from scratch, but I just wonder if I could
utilize the already exsiting ApplicatoinSett ingsBase class. Thank you.
First of all, thank you for your reply.
You could certainly do this since the configuration file is well-formed XML.
But, what do you mean by this? Does this mean that 1)I can do create
my own settings class from scratch or 2)I can derive a class that does
that from the ApplicationSett ingsBase?
I tried
this["undefined key"]=value;
but it causes an exception. How can I dynamically add the "undefined
key" at run-time?
On Feb 1, 10:12 am, Peter Bromberg [C# MVP]
<pbromb...@yaho o.yabbadabbadoo .comwrote:
You could certainly do this since the configuration file is well-formed XML.
The problem is that when you have modified and resaved this file, your
application will not automatically reload it unless it is restarted. If it is
an ASP.NET web app, and you modify the web.config (same concept) this will
cause the application to restart, and you will lose all session, cache and
application state.
Does that help?
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Sin Jeong-hun" wrote:
I've read the "How to: Create Application Settings" article (http://
msdn2.microsoft .com/en-us/library/ms171565.aspx) on the MSDN. It
looked fine. But this code is only good when all the settings entries
are defined at the compile time. And I have to modify the class itself
each and everytime I need more entries. So, is it impossible to get/
save dynamic entries?
I mean, instead of,
MyUserSettings. Background=colo r;
color=MyUserSet tings.Backgroun d;
use this
MySettings["key"]=color;
color=MySetting s["key"];
where "key" can be any string. If "key" doesn't exist, then a new
entry for "key" is created.
I could create my own class from scratch, but I just wonder if I could
utilize the already exsiting ApplicatoinSett ingsBase class. Thank you.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mhouglum |
last post by:
I was wondering, is it possible to programmatically change the initial
settings of an EventLog? Specifically, I would like to create an EventLog
that was set to overwrite events as needed rather than overwrite events older
than 7 days, which is the default. I don't want my users to have to use the
Event Viewer interface for this, I just want the log to be setup like that
upon creation. My program generates a lot of log entries, and the...
|
by: Damian |
last post by:
Hi everyone
I'm having an issue with one of our applications. I'm getting the
following error when attempting to log in to the site:
Server Error in 'xxxxxxxxxxxxxxxx' Application.
--------------------------------------------------------------------------------
Runtime Error
Description: An application error occurred on the server. The current
|
by: Jason Kendall |
last post by:
I've recently installed Beta 2 ov Visual Studio and an updating a few
small applications as a way to get my feet wet with some of the new
functionality. There are many new features which are really going to
make coding a lot simpler.
One area I'm investigating is the new "My.Settings" object. Managing
these is so very easy now, except for one problem. In nearly all of
my applications, I use a class I wrote for reading/writing...
|
by: Mike Livenspargar |
last post by:
We have an application converted from v1.1 Framework to v2.0. The executable
references a class library which in turn has a web reference. The web
reference 'URL Behavior' is set to dynamic. We added an entry to the
executable's .exe.config file to specify the URL, and under the 1.1 framework
this worked well. Unfortunately, this is not working under the 2.0 framework.
I see in the Reference.cs file under the web service reference the...
|
by: penguin732901 |
last post by:
What do experienced programmers find the most efficient way to handle
user settings.
Currently I have 4 tables which allow various clients to customize my
program to work for them, tblAcademicSettings (fields),
tblBillingsettings (32 fields), tblGraphical (23 fields), tblOwner (33
fields).
There is one record for each table. Admittedly, some of the fields
never change once set up, but many are there to allow the user to make
| |
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 many different
dataGridViews to display data, and many of them have 10-20 columns
(the actual number of displayed columns is user/client controlled, and
in a couple cases could be ~30). The client would like to be able to
resize the columns...
|
by: =?Utf-8?B?QWFyb24=?= |
last post by:
I am trying to create dynamic settings in a .NET 2.0 C# application. I need
to be able to store settings on the user, but I do not know how many settings
are necessary at design time because the settings are determined by a
business object that is loaded into the app of which there could be one or
many. I would prefer to use the same LocalFileSettingsProvider that the
settings default to so that I do not have to manage it myself.
Here...
|
by: Just_a_fan |
last post by:
I save some data to an array in my program. I can reopen the setting
screen and see that the data is, in fact, in the array.
I then do a lot of these:
My.Settings.Brkr1 = BreakerAmps(1)
My.Settings.Brkr2 = BreakerAmps(2)
My.Settings.Brkr3 = BreakerAmps(3)
My.Settings.Brkr4 = BreakerAmps(4)
My.Settings.Brkr5 = BreakerAmps(5)
|
by: AGP |
last post by:
VB.NET 2005
I've been working extensively with saving and loading my settings via the
My.Settings class. its worked out great except that i cant figure out how to
set a default setting that is dynamic. That is to say, the default property
changes per user or per machine. As an example, and this is only an example,
the default setting for the center of the screen. In the IDE I can set the
parameter as
ScreenCenter | ...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |