altariamx2003
asked on
how to serialize standard properties of vb control
I made this class
My question would be that if it is possible to serialize the standard properties of the control like "visible" or "enabled"
I dont know why no matter what I do if change the values of the standard properties before serialize this class to a file, when I deserialize from file this properties has the initial values not the values that I put before saved to a file
<Serializable()> _
Public Class MyLabel
Inherits Label
Implements ISerializable
#Region "Initializers"
Public Sub New()
End Sub
#End Region
#Region " properties ..."
Private e_myproperty As String = Nothing
<Browsable(True)> _
Public Property myproperty() As String
Get
Return e_myproperty
End Get
Set(ByVal value As String)
e_myproperty = value
End Set
End Property
#End Region
#Region "Serialization"
Public Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
e_myproperty = info.GetString("myproperty")
End Sub
Public Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) Implements System.Runtime.Serialization.ISerializable.GetObjectData
info.AddValue("myproperty", e_myproperty)
End Sub
#End Region
End Class
My question would be that if it is possible to serialize the standard properties of the control like "visible" or "enabled"
I dont know why no matter what I do if change the values of the standard properties before serialize this class to a file, when I deserialize from file this properties has the initial values not the values that I put before saved to a file
Standard controls are not marked with the <Serializable> attribute, so if you want to do binary serialization of a control, then you're going to have to manually do so with the ISerializable that you are already using.
ASKER
thanks for answer kaufmed
Did you know how to add and serialize into my class a standard property like "visible"???
Did you know how to add and serialize into my class a standard property like "visible"???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works kaufmed!!!!
Thanks a lot!!!!
Thanks a lot!!!!