Persist code for a Collection (for my custom component)

  • Thread starter Thread starter Derrick
  • Start date Start date
D

Derrick

Hello all;

I have created a custom component, whose properties (let's call them
myObjectA and an collection of myObjectB) I'm trying to set via a GUI. I
have the GUI running after the user clicks a Designer Verb, and it gets the
values for myObjectA and myObjectB correctly.

The designer creates the code for myObjectA just fine, however I can't seem
to get it to work for the Collection of myObjectB's. At first I had an
arraylist of myObjectB's, then I tried creating a strongly-typed
myObjectBCollection class (extending CollectionBase), and still nothing. If
I create a singleton instance of myObjectB and fill the values for that, the
code will be generated properly, so I'm confident that the problem lies with
my handling (or lack thereof) of the collection.

What am I missing to get the designer to persist the code for the Collection
object??

Thanks for any and all help!

Derrick
 
Have you marked the collection property with the
DesignerSerializationVisibility attribute?

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public myObjectBCollection Bs
{
get { return objectBs; }
}

HTH;
Eric Cadwell
http://www.origincontrols.com
 
Back
Top