troubleshooting Question

how to serialize standard properties of vb control

Avatar of altariamx2003
altariamx2003Flag for Mexico asked on
.NET ProgrammingVisual Basic.NET
4 Comments1 Solution303 ViewsLast Modified:
I made this class

<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
            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
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros