:: Nested Control does not save its properties ::

Here's my situation:

I have a Custom Control inherited from UserControl. Within this class, i have the following 
declaration:

        Private m_ctlNestedControl As Control

Then I delcare a property as such:

        Public ReadOnly Property NestedControl() As Control
             Get
                 Return m_ctlNestedControl
             End Get
         End Property

Now in design-time, I am able to change the properties of my Custom Control and the Nested 
Control, so far no problem...BUT...when I close Visual Studio and reopen it along with the form 
that contained my Custom Control, I lose all the properties I set for the Nested Control. All the 
properties I set are fine for the User Control, but not the Nested Control, those ones are back to 
the original ones. Would anyone know why 


Answer this question

:: Nested Control does not save its properties ::

  • iulmer


    Imports System.ComponentModel

    ...

    <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
    Public ReadOnly Property NestedControl() As Control
        Get
            Return m_ctlNestedControl
        End Get
    End Property

  • Jack M

    Yes, it worked :) But with a bug. I should be able to fix it. I tested it with a nested textbox. I 
    changed the Border Style, Back Color, Text, and Tag properties, and only the BorderStyle didn't 
    save. But it's a start, I should be able to work out the little Border Style bug. Thanx very much   :)

  • :: Nested Control does not save its properties ::