473,414 Members | 1,876 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,414 software developers and data experts.

User objects in application settings?

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 form app's namespace.
Now I want to add an instance of this class to my Application Settings. So,
I go to Project | Properties | Settings tab and while I can add settings of
various system types I can't seem to add one of type "Foo". I tried
Browse... but while it shows various system types, it doesn't show my class.

How the heck do I create a setting of type "Foo"???

Once I've got that figured out, how do I create an list of "Foo"s that can
be saved in my settings?

BTW, I use this as an example. I realize that if all I wanted to store was
a string there are simpler built in types.

Thanks!
Grant Schenck

// -----------------
public class Foo
{
Foo() {}

public string Name
{
get { return m_strName; }
set { m_strName = value; }
}

private string m_strName;
}
Jun 12 '07 #1
2 1708
Any ideas???

Thanks,

Grant Schenck

"Grant Schenck" <sc******@optonline.netwrote in message
news:%2*****************@TK2MSFTNGP06.phx.gbl...
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 form app's
namespace. Now I want to add an instance of this class to my Application
Settings. So, I go to Project | Properties | Settings tab and while I can
add settings of various system types I can't seem to add one of type
"Foo". I tried Browse... but while it shows various system types, it
doesn't show my class.

How the heck do I create a setting of type "Foo"???

Once I've got that figured out, how do I create an list of "Foo"s that can
be saved in my settings?

BTW, I use this as an example. I realize that if all I wanted to store
was a string there are simpler built in types.

Thanks!
Grant Schenck

// -----------------
public class Foo
{
Foo() {}

public string Name
{
get { return m_strName; }
set { m_strName = value; }
}

private string m_strName;
}


Jun 12 '07 #2
On Tue, 12 Jun 2007 05:52:23 -0700, Grant Schenck <sc******@optonline.net>
wrote:
"Grant Schenck" <sc******@optonline.netwrote in message
news:%2*****************@TK2MSFTNGP06.phx.gbl...
>>
I have a very simple class (see below) which I think should be XML
serializable. I have this class defined in my simple form app's
namespace. Now I want to add an instance of this class to my Application
Settings.

Any ideas???
Well, since no one who actually knows the answer stepped up, I'll tell you
what I do know:

If your object is serializable, you can save it in your settings.

To make an object serializable, you add the "[Serializable]" property just
before the class. I haven't had a need to do this sort of thing yet, but
my understanding is that if all the members are already serializable, and
you don't want any special handling for any of the members, then that's
all you need to do in order to make the whole class serializable.

It seems to me that those two pieces of information together should
address your question.

If not, well...I did warn you that I don't actually know the answer. :)

Pete
Jun 12 '07 #3

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

Similar topics

3
by: Test Test | last post by:
Hi, group! Here is some interesting problem: Our company has developed a large VB6 application that runs very smoothly on most environments. However, all of a sudden one of our customers...
2
by: Nevyn Twyll | last post by:
I understand that I am not supposed to alter the .config file for a program (accessible through the AppSettings). Is there a System class you could recommend that I could use (or even a class...
11
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
5
by: mabond | last post by:
Hi all This question is one of "theory" rather than a search for the specifics of a solution. I need some pointers as to how to proceed with my project. Here goes. My application allows the...
2
by: Dave Booker | last post by:
How are complex data types saved and restored when used as User-scoped Application Settings? For an example of what I'm trying to do that does not work, take the following: A project has a...
4
by: RedHair | last post by:
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...
5
by: Steve Barnett | last post by:
I added some user settings to my app which caused the Settings.settings to be generated etc... and all was well and lovely and the Sun was shining. Then I changed the version number of my...
3
by: Piotrekk | last post by:
Hi I have a problem connected with user.config file. I am using default settings.settings . To settings.settings I am adding one user scope string and one application scope string. Thus...
1
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am using the My.Settings object to save user settings. During testing, I want to 'zero' out what has been saved to start with the defaults again. Where doies the framwork actually persist these...
1
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have an application where the user can configure the an area of the UI to contain a variable number of 'plans', lets say 0 to 6 of them. Each 'plan' has a description and a type amongst other...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...
0
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...

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.