Home All Groups Group Topic Archive Search About

Custom Type for Application Settings

Author
8 Apr 2006 4:24 PM
Mark Olbert
You can browse for a Type to use as the basis of an application setting (at least under VS2005/NET2)...but how do you define your
own custom Type so that it can be used as the basis of an application setting?

I would like to be able to hold a collection of MyClass objects (via a List<MyClass>) in the application settings.

- Mark

Author
10 Apr 2006 9:17 AM
Gary Chang[MSFT]
Hi Mark,

>I would like to be able to hold a collection of MyClass objects (via a
List<MyClass>) in the application settings.

If you mean to do this via code, not in the VS2005 IDE's UI wizard (Project
| Properties | Settings tab page), then there are two approaches you can
choose.

1. Implement the TypeConverter to your custom type.
2. Define your custom type as XML serializable.

I suggest you can refer to the following MSDN documentations for the
detailed information about the above workarounds:

How to: Implement a Type Converter 
http://msdn2.microsoft.com/en-us/library/ayybcxe5(VS.80).aspx

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemxmlserializationxmlserializerclasstopic.asp

If you have any issues or concerns, please let me know. It's my pleasure to
be of assistance.

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006.  Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
11 Apr 2006 3:19 AM
Mark Olbert
Gary,

I'm familiar with implementing both TypeConverters and marking classes as XmlSerializable. How does doing either let the class show
up in the VS2005 UI for setting properties?

- Mark

On Mon, 10 Apr 2006 09:17:01 GMT, v-gar***@online.microsoft.com ("Gary Chang[MSFT]") wrote:

Show quote
>Hi Mark,
>
>>I would like to be able to hold a collection of MyClass objects (via a
>List<MyClass>) in the application settings.
>
>If you mean to do this via code, not in the VS2005 IDE's UI wizard (Project
>| Properties | Settings tab page), then there are two approaches you can
>choose.
>
>1. Implement the TypeConverter to your custom type.
>2. Define your custom type as XML serializable.
>
>I suggest you can refer to the following MSDN documentations for the
>detailed information about the above workarounds:
>
>How to: Implement a Type Converter 
>http://msdn2.microsoft.com/en-us/library/ayybcxe5(VS.80).aspx
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
>frlrfsystemxmlserializationxmlserializerclasstopic.asp
>
>If you have any issues or concerns, please let me know. It's my pleasure to
>be of assistance.
>
>Thanks!
>
>Best regards,
>
>Gary Chang
>Microsoft Community Support
>======================================================
>PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
>AM PST, February 14, 2006.  Please complete a re-registration process by
>entering the secure code mmpng06 when prompted. Once you have entered the
>secure code mmpng06, you will be able to update your profile and access the
>partner newsgroups.
>==================================================
>When responding to posts, please "Reply to Group" via your newsreader so
>that others may learn and benefit from your issue.
>==================================================
>This posting is provided "AS IS" with no warranties, and confers no rights.
Author
11 Apr 2006 4:20 AM
Carl Daniel [VC++ MVP]
Mark Olbert wrote:
> Gary,
>
> I'm familiar with implementing both TypeConverters and marking
> classes as XmlSerializable. How does doing either let the class show
> up in the VS2005 UI for setting properties?

It doesn't.  The application settings facility in VS2005 is rather flawed,
and not really finished.  The types that are present in the settings editor
when you first opened it are in fact the only types that will work.

See

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=FDBK30022

for more.

-cd
Author
11 Apr 2006 6:04 AM
Mark Olbert
Carl,

Thanks for the info. Now at least I won't waste time trying to do something that currently can't be done.

Having had to implement a design-time Type resolver for a database framework I wrote, I can appreciate how complex that type of
solution is.

- Mark

AddThis Social Bookmark Button