I am trying to use a custom type inside settings.settin gs. When I create my
class, I am able to add it in as the type and the value ends up showing as
XML data. If I change any of the values in my class, the values do not
update the settings file. Can anyone provide any insight and/or sample code
on how to use a user defined class as a valid and usable type in the
settings.settin gs file?
Thanks,
--Rob. 3 4392
It must be a User-scoped Setting, and you must save the Settings prior to
closing the app.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
"Rob L" <Ro**@discussio ns.microsoft.co mwrote in message
news:F9******** *************** ***********@mic rosoft.com...
>I am trying to use a custom type inside settings.settin gs. When I create my
class, I am able to add it in as the type and the value ends up showing as
XML data. If I change any of the values in my class, the values do not
update the settings file. Can anyone provide any insight and/or sample
code
on how to use a user defined class as a valid and usable type in the
settings.settin gs file?
Thanks,
--Rob.
Kevin:
Thanks for the response. I have the setting scoped as user, and I do call
the save method.
What I am looking to do is, lets say I have a class like this:
class MyClass
{
public int firstVariable;
public int secondVariable;
public string someString;
}
and I want to store the values of this class in the settings.settin gs, so in
the settings designer I chose "MyApp.MyCl ass" as the type with the scope of
user and the tool generated a block of XML in the app.config file. I am able
to get the settings by reading
Properties.Sett ings.Default.My Class.firstVari able, etc., however, I am unable
to update and save the values back to the config file.
Any ideas?
Thanks,
--Rob.
"Kevin Spencer" wrote:
It must be a User-scoped Setting, and you must save the Settings prior to
closing the app.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
"Rob L" <Ro**@discussio ns.microsoft.co mwrote in message
news:F9******** *************** ***********@mic rosoft.com...
I am trying to use a custom type inside settings.settin gs. When I create
my
class, I am able to add it in as the type and the value ends up showing as
XML data. If I change any of the values in my class, the values do not
update the settings file. Can anyone provide any insight and/or sample
code
on how to use a user defined class as a valid and usable type in the
settings.settin gs file?
Thanks,
--Rob.
Are you assigning the Settings class instance to a variable, and saving that
at the end, or creating another instance and saving that at the end? If you
reference the actual instance in the Settings, when you save it should be
serialized back.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
"Rob L" <Ro**@discussio ns.microsoft.co mwrote in message
news:C0******** *************** ***********@mic rosoft.com...
Kevin:
Thanks for the response. I have the setting scoped as user, and I do call
the save method.
What I am looking to do is, lets say I have a class like this:
class MyClass
{
public int firstVariable;
public int secondVariable;
public string someString;
}
and I want to store the values of this class in the settings.settin gs, so
in
the settings designer I chose "MyApp.MyCl ass" as the type with the scope
of
user and the tool generated a block of XML in the app.config file. I am
able
to get the settings by reading
Properties.Sett ings.Default.My Class.firstVari able, etc., however, I am
unable
to update and save the values back to the config file.
Any ideas?
Thanks,
--Rob.
"Kevin Spencer" wrote:
>It must be a User-scoped Setting, and you must save the Settings prior to closing the app.
-- HTH,
Kevin Spencer Microsoft MVP
Printing Components, Email Components, FTP Client Classes, Enhanced Data Controls, much more. DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
"Rob L" <Ro**@discussio ns.microsoft.co mwrote in message news:F9******* *************** ************@mi crosoft.com...
>I am trying to use a custom type inside settings.settin gs. When I create my
class, I am able to add it in as the type and the value ends up showing
as
XML data. If I change any of the values in my class, the values do not
update the settings file. Can anyone provide any insight and/or sample
code
on how to use a user defined class as a valid and usable type in the
settings.settin gs file?
Thanks,
--Rob.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sonu |
last post by:
I have following client side code which i have used in my asp.net
project
SummaryFeatured Resources from the
IBM Business Values Solution Center
WHITEPAPER :
CRM Done Right
Improve the likelihood of CRM success from less than 20 percent to 60
percent.
WHITEPAPER :
|
by: eugenet |
last post by:
Hello,
I am writing a Windows Forms application using .NET Framework 2.0 and
Visual Studio 2005.
I would like to use Properties.Settings class to persist a collection
of custom objects. For that I am creating a setting called Connections
of type System.Collections.ArrayList using the Properties designer in
VS.
|
by: rob |
last post by:
Using the settings editor I am trying to add a setting whose type is a
custom type. In a first approach I tried a class marked as
. But then when I try to get the property the way shown
bellow I get null returned.
MyProperties prop = Properties.Settings.Default.MyProp
Assuming prop is null because MyProperties is not a value type I
changed MyProperties from a class to a struct. Unfortunately, settings
editor does not allow me to add a...
|
by: modi321 |
last post by:
Everyone,
I have a question on how to use persistant application settings with
2.0. I understand I can use defined types like ints, strings, and so
on, but how about my own custom class? The problem is I can fill in
the 'type' of the setting as my custom class, but if I try to save the
settings - calling the My.Settings.Save() - then reload the settings at
a later time with the My.Settings.Reload() - the data in my custom
class is not...
|
by: Ivan Berg |
last post by:
Hey everyone, hopefully this will have a simple answer. Using VS2005/.NET
2.0 Application settings.
I have simple settings working fine, but I am trying to store more complex
types now.
For example a collection of city/state/country's
e.g.
| |
by: Michael Slattery |
last post by:
Hello,
I see quite a few questions, but no valid responses to the question...
How do I store an ArrayList of items in a Properties file via the GUI?
I am able to select the System.Collections.ArrayList type, but I'm unable to
determine what to type into the Value feild for a default setting so the
property will not be null at runtime...
|
by: JamminJimE |
last post by:
I dunno if it's too late at night to be coding without the caffeine,
but I am sure trying.
I have a web app that I am working on and am trying to set some of the
custom My.Settings values. Each of my settings that I created show up
fine in intellisense, but when I execute the app, I get...
******************************
Compilation Error
|
by: =?Utf-8?B?RnV0cm9uaWNzIERldmVsb3Blcg==?= |
last post by:
I am trying to store a collection of custom types in a Properties.Settings
file which I will be updating at run time and saving on exit of the program.
I understand how to use the Properties.Settings file in this way for normal
types (ints, chars etc) but I am struggling to get it to work for my own
types.
The type I want to use in the Settings file is a custom implementation of
the generic Dictionary class using a string and another...
|
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 seen erratic
results. I am aware of one known defect where user classes do not show up in
the list of types on the Property/Settings page in the visual designer and I
am wondering if I am encountering some other peculiar issue, or if there are...
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |