Lose Custom Collection In UserControl


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Lose Custom Collection In UserControl

Hybrid View

  1. #1
    BigDave Guest

    Lose Custom Collection In UserControl


    I am losing items in a custom collection in a usercontrol I have written.

    I have created a usercontrol called DockMaster which holds dock-areas I have
    set up on the main form (e.g. top, bottom, left etc.).

    Dockmaster has a property called DockPositions which is actually a custom
    collection (collection class). The collection class holds individual dockpositions
    (another user control).

    I can add dockpositions to dockmaster at design time. All seems fine. The
    control renders correctly on the form.

    When I close the form that holds dockmaster, and then re-open it, my collection
    is gone. But the controls still exist in the dockmaster container, i.e.
    I can still change the properties of individual dockpositions (by clicking
    on them inside dockmaster on the form) - but when I go to the dockpositions
    collection (accessed from the default properties form) it is empty.

    Anyone have any ideas that may help? I have found it really difficult to
    find help on component authoring for DotNet.

  2. #2
    Patrick Steele [MVP] Guest

    Re: Lose Custom Collection In UserControl

    In article <3c6756be$1@10.1.10.29> (from BigDave <david@sst.net.au>),
    >
    > I am losing items in a custom collection in a usercontrol I have written.
    >
    > I have created a usercontrol called DockMaster which holds dock-areas I have
    > set up on the main form (e.g. top, bottom, left etc.).
    >
    > Dockmaster has a property called DockPositions which is actually a custom
    > collection (collection class). The collection class holds individual dockpositions
    > (another user control).


    Are your DockPositions collection along with the individual objects it
    holds serializable? I'm not positive on this, but I believe the
    settings are saved by serializing them. If they're not serializable,
    they won't get saved.

    --
    Patrick Steele
    Microsoft .NET MVP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center