gregsdennis
New member
- Joined
- Jan 10, 2011
- Messages
- 4
- Programming Experience
- 1-3
See code below:
I'm able to add the component to a form and access DataList just fine in the design view. But when I open the dialog to add objects to the list, it won't save. I can add objects, close the dialog, and when I reopen the dialog, there are no objects.
I've tried adding the New keyword in front of list with no luck. I have also tried explicitly declaring the DataList data member and using a Get/Set on the property, but that didn't work either.
Anyone know what's going on?
VB.NET:
<Serializable()>
Public Class DataObject
Implements ISerializable
Dim txt As String = nothing
Dim vlu As Integer = 0
Public Property Text as String
Get
Return txt
End Get
Set(value As String)
txt = value
End Set
End Property
Public Property Val as Integer
Get
Return vlu
End Get
Set(value As Integer)
vlu = value
End Set
End Property
Public Sub New()
End Sub
Public Sub GetObjectData(ByVal info As SerializationInfo, ByVal context As StreamingContext) Implements ISerializable.GetObjectData
If info IsNot Nothing Then
info.AddValue("txt", txt)
info.AddValue("vlu", vlu)
End If
End Sub
End Class
Public Class DataManager
Inherits System.ComponentModel.Component
Public Property DataList As List(Of DataObject)
End Class
I'm able to add the component to a form and access DataList just fine in the design view. But when I open the dialog to add objects to the list, it won't save. I can add objects, close the dialog, and when I reopen the dialog, there are no objects.
I've tried adding the New keyword in front of list with no luck. I have also tried explicitly declaring the DataList data member and using a Get/Set on the property, but that didn't work either.
Anyone know what's going on?
Last edited: