471,348 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

ExpandableObjectConverter and CollectionBase

Hi,

I'm using classes with the ExpandableObjectConverter attibute in a
UserControl for properties. This works fine for some classes, and properties
of these classes can be edited during design time.
However, classes which are derived from CollectionBase don't save their
values in the form's code. Properties can be changed in the VStudio property
editor but they are not persistent:

// Property values are saved in the forms code.
// e.g. "this.userControl11.Test.Value = 5;"
[TypeConverter(typeof(ExpandableObjectConverter))]
public class TestClass {
private int _i = 0;
public TestClass() {}

[DefaultValue(typeof(int), "0")]
public int Value {
set {_i = value;}
get {return _i;}
}
}

// Problem: Property values can be changed but are NOT saved in the forms
code
[TypeConverter(typeof(ExpandableObjectConverter))]
public class TestClassCol : CollectionBase {
private int _i = 0;
public TestClassCol() {}

[DefaultValue(typeof(int), "0")]
public int Value {
set {_i = value;}
get {return _i;}
}
}

Does anybody know how to make collection base derived classes save their
values in the form code ?

Many thanks in advance,

Marcus
Dec 8 '05 #1
0 1416

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Pol Bawin | last post: by
5 posts views Thread by Eric Johannsen | last post: by
reply views Thread by Adriano Coser | last post: by
2 posts views Thread by Samuel R. Neff | last post: by
2 posts views Thread by =?Utf-8?B?TWFyayBDb2xsYXJk?= | last post: by
reply views Thread by Rohan | 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.