Collection property

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marc L'Ecuyer

    Collection property

    I want to implement a collection property inside another (in a control
    derived class) but I have some persistence problems.

    There is an example of my ColumnItem class

    <TypeConverter( GetType(ColumnI temConverter))> _

    Public Class ColumnItem

    Private m_strText As String

    Private m_intWidth As Integer

    Private m_imgImage As Image

    Private m_colValueItems As ValueItemsColle ction

    Public Sub New()

    '...

    End Sub

    Public Property Text() As String

    Get

    Return m_strText

    End Get

    Set(ByVal Value As String)

    m_strText = Value

    End Set

    End Property

    Public Property Width() As Integer

    Get

    Return m_intWidth

    End Get

    Set(ByVal Value As Integer)

    m_intWidth = Value

    End Set

    End Property

    <Editor(GetType (CollectionEdit or), GetType(UITypeE ditor)), _

    DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)> _

    Public ReadOnly Property ValueItems() As ValueItemsColle ction

    Get

    Return m_colValueItems

    End Get

    End Property

    '... other properties

    End Class


    I have a CollectionBase derived class object that contains all my
    columnitems.
    ValueItemsColle ction is another CollectionBase derived class for my
    sub-collection.
    When I enter new columns in design time, nothing is serialized in the
    InitializeCompo nent of the form.

    Does anybody could send me some tips about how to do that?

    Thanks


  • Shawn Burke [MS]

    #2
    Re: Collection property

    You probably need to add InstanceDescrip tors for your collection contents.
    Read this and it should get you pointed in the right direction:



    t/html/custcodegen.asp ?frame=true



    --

    Please do not reply to this alias directly. This posting is provided "AS
    IS" with no warranties, and confers no rights. You assume all risk for your
    use. © 2002 Microsoft Corporation. All rights reserved.


    "Marc L'Ecuyer" <mlecuyer@chca. ca> wrote in message
    news:ObbORDOPDH A.1584@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I want to implement a collection property inside another (in a control
    > derived class) but I have some persistence problems.
    >
    > There is an example of my ColumnItem class
    >
    > <TypeConverter( GetType(ColumnI temConverter))> _
    >
    > Public Class ColumnItem
    >
    > Private m_strText As String
    >
    > Private m_intWidth As Integer
    >
    > Private m_imgImage As Image
    >
    > Private m_colValueItems As ValueItemsColle ction
    >
    > Public Sub New()
    >
    > '...
    >
    > End Sub
    >
    > Public Property Text() As String
    >
    > Get
    >
    > Return m_strText
    >
    > End Get
    >
    > Set(ByVal Value As String)
    >
    > m_strText = Value
    >
    > End Set
    >
    > End Property
    >
    > Public Property Width() As Integer
    >
    > Get
    >
    > Return m_intWidth
    >
    > End Get
    >
    > Set(ByVal Value As Integer)
    >
    > m_intWidth = Value
    >
    > End Set
    >
    > End Property
    >
    > <Editor(GetType (CollectionEdit or), GetType(UITypeE ditor)), _
    >
    > DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)>[/color]
    _[color=blue]
    >
    > Public ReadOnly Property ValueItems() As ValueItemsColle ction
    >
    > Get
    >
    > Return m_colValueItems
    >
    > End Get
    >
    > End Property
    >
    > '... other properties
    >
    > End Class
    >
    >
    > I have a CollectionBase derived class object that contains all my
    > columnitems.
    > ValueItemsColle ction is another CollectionBase derived class for my
    > sub-collection.
    > When I enter new columns in design time, nothing is serialized in the
    > InitializeCompo nent of the form.
    >
    > Does anybody could send me some tips about how to do that?
    >
    > Thanks
    >
    >[/color]


    Comment

    Working...