471,319 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Properties.Settings; ArrayList and a custom object

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.

At run-time I populate an arraylist with instances of my class and then
I set the Connections property to this arraylist. Then, I execute the
Save command on the Settings.Default.

The Save command does not generate an error, but no settings are
persisted either.

Do I need to do something special with ArrayList and my class
(serialization, perhaps) in order for settings to be persisted
correctly?

Many thanks for your help!

Evgueni

Jan 28 '06 #1
4 8574
Evgueni,

I have your same problem; have you found a solution or a reason why
this is not working?

Thank you,
Gabriele

Feb 6 '06 #2
Unfortunately, no. Nobody responded to this posting or to the
WindowsForms.net forum...

Feb 6 '06 #3
I haven't been able to find this information either. I'm using one of my
MSDN support incidents on it. I'll post what they come up with.

"po*****@hotmail.com" wrote:
Unfortunately, no. Nobody responded to this posting or to the
WindowsForms.net forum...

Feb 15 '06 #4
Hello Eugene.

I think I've figured this one out. I haven't tried it out on ArrayList but
it's worked for every Type I've tried it on, including Bitmaps and custom
types.

First of all, if your type is a custom type (like class MyFont : Font) then
you'll have to mark it as [Serializable] and implement ISerializable. I
think you also have to write a serializable constructor.

Then you mark your settings property with
[SettingsSerializeAs(SettingsSerializeAs.Binary)]. Settings of certain types
cannot be created in the designer. In that case you'll have to add a file
Settings.cs that extends your internal sealed partial class Settings.

Tony
To**********@Fluke.com

"eu*****@rusmex.com" wrote:
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.

At run-time I populate an arraylist with instances of my class and then
I set the Connections property to this arraylist. Then, I execute the
Save command on the Settings.Default.

The Save command does not generate an error, but no settings are
persisted either.

Do I need to do something special with ArrayList and my class
(serialization, perhaps) in order for settings to be persisted
correctly?

Many thanks for your help!

Evgueni

Feb 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by a | last post: by
reply views Thread by a | last post: by
9 posts views Thread by Greger | last post: by
13 posts views Thread by Dave | last post: by
2 posts views Thread by =?Utf-8?B?Y3Nz?= | last post: by
reply views Thread by =?Utf-8?B?RnV0cm9uaWNzIERldmVsb3Blcg==?= | last post: by
1 post views Thread by =?Utf-8?B?Q2hhcmxlcw==?= | last post: by

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.