Persisting Collection in Component

S

Shawn B.

I have a component that derives from "Component" but I cannot make a
collection property persist, it always loses its state next time I eneter
the page or rebuild the project...


-----------

Imports System.ComponentModel

Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls

Imports System.Web
Imports system.Web.UI
Imports System.Web.UI.WebControls


<ToolboxItem(True)> _
Public NotInheritable Class XmlRulesValidator
Inherits System.ComponentModel.Component

#Region " Component Designer generated code "

Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()

'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub

Public Sub New()
MyBase.New()

'This call is required by the Component Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Component overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Component Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container()
End Sub

#End Region

Private _defaultRulesFile As String =
"/universal_validation/validation_rules.xml"
Private _rules As XmlRuleCollection


<Category("Behavior")> _
Public Property DefaultRulesFile() As String
Get
Return _defaultRulesFile
End Get
Set(ByVal Value As String)
_defaultRulesFile = Value
End Set
End Property

< _
Category("Behavior"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
_
Public ReadOnly Property Rules() As XmlRuleCollection
Get
If (_rules Is Nothing) Then
_rules = New XmlRuleCollection()
End If

Return _rules
End Get
End Property

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top