VB.Net Usercontrol属性未应用

时间:2014-06-22 14:59:40

标签: vb.net user-controls

我有一个textbox usercontrol,其属性类型为validation,它派生自我的一个类。在设计器中,属性显示为集合,但是我添加到该集合的项目不会被保存。这是完整的代码。

Public Class validationList
    Private _key As validationTypes
    Private _value As String

    Sub New()
      _key = 0
      _value = ""
    End Sub

    Public Sub New(ByVal k As validationTypes, ByVal v As String)
      _key = k
      _value = v
    End Sub

    Public Enum validationTypes
        man = 0
        num = 1
    End Enum

    Public Property Key As validationTypes
        Get
            Return _key
        End Get
        Set(ByVal value As validationTypes)
            _key = value
        End Set
    End Property

    Public Property value As String
        Get
            Return _value
        End Get
        Set(ByVal value As String)
            _value = value
        End Set
    End Property
End Class

这是通过usercontrol公开的属性

Private _validation As List(Of validationList)

    Public Property validation As List(Of validationList)
        Get
            Return _validation
        End Get
        Set(ByVal value As List(Of validationList))
            _validation = value
        End Set
    End Property

0 个答案:

没有答案