Click here to Skip to main content
15,895,011 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralModifying and adding controls to parentform Pin
Amaterasuv18-Jan-05 8:14
Amaterasuv18-Jan-05 8:14 
GeneralRe: Accessing a Form from another Pin
Dave Kreskowiak18-Jan-05 8:19
mveDave Kreskowiak18-Jan-05 8:19 
GeneralRe: Accessing a Form from another Pin
Rizwan Bashir19-Jan-05 0:37
Rizwan Bashir19-Jan-05 0:37 
GeneralLocalizing Crystal Reports Pin
Amaterasuv18-Jan-05 1:01
Amaterasuv18-Jan-05 1:01 
GeneralEditing MIDI File Pin
girijaa18-Jan-05 0:37
professionalgirijaa18-Jan-05 0:37 
Generalvb.net Pin
Anonymous17-Jan-05 23:51
Anonymous17-Jan-05 23:51 
GeneralRe: vb.net Pin
Tom John18-Jan-05 0:02
Tom John18-Jan-05 0:02 
GeneralObject Property Serialization Pin
Tom John17-Jan-05 23:32
Tom John17-Jan-05 23:32 
Hey Guys

I'm having problems serializing an class that has an object property, even though the object in the instance of that class is serializable. I've cut the code down to demonstrate:

Option Strict On

<Serializable()> Public Class Test

    Public Sub New()
    End Sub

    Dim m_text As String
    Public Property Text() As String
        Get
            Return m_text
        End Get
        Set(ByVal Value As String)
            m_text = Value
        End Set
    End Property

End Class

<Serializable()> Public Class TestTag

    Public Sub New()
    End Sub

    Dim m_text As String
    Public Property Text() As String
        Get
            Return m_text
        End Get
        Set(ByVal Value As String)
            m_text = Value
        End Set
    End Property

    Dim m_tag As Object
    Public Property Tag() As Object
        Get
            Return m_tag
        End Get
        Set(ByVal Value As Object)
            m_tag = Value
        End Set
    End Property

End Class

Public Class StartUp

    Public Shared Sub Main()

        Dim ser As New Xml.Serialization.XmlSerializer(GetType(TestTag))
        Dim file As New System.IO.StreamWriter("c:\temp\test.xml")
        Dim obj1 As New TestTag
        Dim obj2 As New Test

        obj1.Text = "TestTag Object"
        obj2.Text = "Test Object"
        obj1.Tag = obj2

        ser.Serialize(file, obj1)

        file.Close()

        MsgBox("Object Serialized")

    End Sub

End Class


Really, all i think all i need to do is change the Tag property of the TagTest class to an type that is know to be serialized, i have tried ISerializable but it don't want to know.

Failing that, i assume i'll just have to implement ISerializable on the TagTest class, but it seems a lot of work just for the one property.

Any ideas greatly appreciated.

Tom
GeneralRe: Object Property Serialization Pin
-Dr_X-20-Jan-05 13:37
-Dr_X-20-Jan-05 13:37 
Generalaccessing property of dynamically created controls using vb.net code behind Pin
udita17-Jan-05 19:15
udita17-Jan-05 19:15 
GeneralRe: accessing property of dynamically created controls using vb.net code behind Pin
Rizwan Bashir17-Jan-05 20:21
Rizwan Bashir17-Jan-05 20:21 
QuestionWhy could not exit from a form? Pin
rushing17-Jan-05 18:27
rushing17-Jan-05 18:27 
AnswerRe: Why could not exit from a form? Pin
Amaterasuv18-Jan-05 8:02
Amaterasuv18-Jan-05 8:02 
GeneralRe: Why could not exit from a form? Pin
rushing18-Jan-05 16:35
rushing18-Jan-05 16:35 
QuestionHow to Custome selected item background color in a listview Pin
NarayanVl17-Jan-05 17:07
NarayanVl17-Jan-05 17:07 
AnswerRe: How to Custome selected item background color in a listview Pin
Tom John17-Jan-05 23:35
Tom John17-Jan-05 23:35 
QuestionHow to gray out a single item in a checked listbox? Pin
NarayanVl17-Jan-05 16:59
NarayanVl17-Jan-05 16:59 
AnswerRe: How to gray out a single item in a checked listbox? Pin
Tom John17-Jan-05 23:36
Tom John17-Jan-05 23:36 
GeneralRemoving Localizing Languages Pin
Amaterasuv17-Jan-05 14:24
Amaterasuv17-Jan-05 14:24 
GeneralPrint Pin
Yulianto.17-Jan-05 14:04
Yulianto.17-Jan-05 14:04 
GeneralRe: Print Pin
Edbert P17-Jan-05 18:30
Edbert P17-Jan-05 18:30 
GeneralRe: Print Pin
Yulianto.17-Jan-05 21:43
Yulianto.17-Jan-05 21:43 
GeneralRe: Print Pin
Yulianto.18-Jan-05 18:13
Yulianto.18-Jan-05 18:13 
GeneralRe: Print Pin
Jodd19-Jan-05 14:41
Jodd19-Jan-05 14:41 
GeneralUpdating datasource from dataset Pin
BettySchettig17-Jan-05 13:29
BettySchettig17-Jan-05 13:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.