473,396 Members | 1,998 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,396 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 1502

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

Similar topics

5
by: Steve M | last post by:
I have subclassed CollectionBase. I have also implemented GetEnumerator(). I have tried to set the DataSource of a DataGrid to an instance of my subclass. However, the items in the grid are not...
1
by: Pol Bawin | last post by:
Hi, I have a objectA with a property that return an object B (accessor GET only) I have defined an ExpandableObjectConverter on the type B and overrided CanConvertTo, CanConvertFrom, ... The...
5
by: Eric Johannsen | last post by:
I have a simple object that inherits from CollectionBase and overrides the Count property: namespace MyTest { public class CollTest : System.Collections.CollectionBase { public override int...
0
by: Vladimir.Sakharuk | last post by:
I have created ExpandableObjectConverter in C#. for use in System.Windows.Forms.PropertyGrid. The property grid shows the DiffItem is a object that holds member TheItem. without expanding...
0
by: Adriano Coser | last post by:
Hello. I'm facing the exact problem described here:...
0
by: Adriano Coser | last post by:
Hello. I have an ExpandableObjectConverter subclass that I associate to the 'Converter' of a custom property descriptor. After I changed my .net code to the new syntax (VC 2005), the...
2
by: Samuel R. Neff | last post by:
What's the advantage of inheriting from CollectionBase as opposed to just implementing IList? It seems that it saves you from having to implement a few properties (Clear, CopyTo, Count,...
2
by: =?Utf-8?B?TWFyayBDb2xsYXJk?= | last post by:
I've created a usercontrol with a Person property. The Person property returns a Person object. I've also created a PersonConverter class which inherits the ExpandableObjectConverter so the Person...
0
by: Rohan | last post by:
Hello, i am doing a custom class for my property for a property gird using ExpandableObjectConverter. I have a class (CustomFontClass) that uses a Converter which inherits the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
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,...
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
tracyyun
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...
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,...

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.