views:

66

answers:

1

Who can tell me the internal working mechanism of a CollectionEditor in plain English?

I have implemented every virtual function and step into each of them. Still got no clue of its intended algorithm. I searched the web and found tons of compaints about the CollectionEditor type, and even bugs.

I am kind of thinking of the CollectionEditor as a total mess.

+1  A: 

Check out How to Edit and Persist Collections with CollectionEditor By Daniel Zaharia, The article demonstrates how to edit and persist collections with CollectionEditor. http://www.codeproject.com/KB/cs/dzcollectioneditor.aspx. I found it a good resource. Another good example is Create a PanelManager at http://dotnetrix.co.uk/custom.htm.

I have had no problem using the CollectionEditor. It is fairly straight forward. I did have trouble at first with the ExpandableObjectConverter that I created because I didn't understand it purpose. The MSDN Library is a good source for this. For another reference and actual example of "How to: Implement a Type Converter", see MSDN: http://msdn.microsoft.com/en-us/library/ayybcxe5.aspx.

Why do you want to know the "internal workings"? What is your specific trouble? Is your trouble with the editor or the type converter? You can download Microsoft's source code for the .NET Framework or inspect the CollectionEditor using .NET Reflector. When I reviewed the code, it really didn't help me.

From my limited understanding, the CollectionEditor uses the TypeConverter to create the constructor code used in the designer-generated form code.

Regarding your NullReference, debugging design-time controls will find your problem. See Walkthrough: Debugging Custom Windows Forms Controls at Design Time at http://msdn.microsoft.com/en-us/library/5ytx0z24(VS.80).aspx.

AMissico
Thanks, AMissico. I am always getting NullReference exception when trying to edit an item of myType within a CollectionEditor. So I want to know how the CollectionEditor interact with my TypeConverter.
smwikipedia
Did it help? The CollectionEditor uses the TypeConverter to create the constructor code used in the designer-generated form code. Debugging design-time controls will find your problem with NullReference. Also, check TypeConverter example in MSDN Library.
AMissico