How Do I Persist Windows Controls To Disk?

  • Thread starter Thread starter andrew
  • Start date Start date
A

andrew

I am trying to save data to disk. I intend using the
Binary Formatter Class.

I have an arraylist populated with custom class objects.
Several of these custom classes contain button controls as
properties.

i.e

Public Class MyCustomClass

Property Button As System.Windows.Forms.Button
Get
Set
End Property

Sub New
Button.Text = "Set Value at RunTime"
End Sub

End Class


In the main module I add new instances of MyCustomClass to
an ArrayList and then attempt to persist it to disk.

i.e
Sub Main
Dim A As New ArrayList(1)

Dim C As New MyCustomClass

C.Button.Text ="NewValue"
A.Add(C)


Dim FS As FileStream
SF= File.Create(PATHNAME)
formatter As BinaryFormatter
formatter= New BinaryFormatter
formatter.serialization(SF, A)
SF.Close
End Sub


The code doesn't execute. I have tested various options
and it seems that the button property of MyCustomClass (or
any Button Class for that matter) won't take to
serialization.

Is there any way around this??
 
-----Original Message-----
I am trying to save data to disk. I intend using the
Binary Formatter Class.

I have an arraylist populated with custom class objects.
Several of these custom classes contain button controls as
properties.

i.e

Public Class MyCustomClass

Property Button As System.Windows.Forms.Button
Get
Set
End Property

Sub New
Button.Text = "Set Value at RunTime"
End Sub

End Class


In the main module I add new instances of MyCustomClass to
an ArrayList and then attempt to persist it to disk.

i.e
Sub Main
Dim A As New ArrayList(1)

Dim C As New MyCustomClass

C.Button.Text ="NewValue"
A.Add(C)


Dim FS As FileStream
SF= File.Create(PATHNAME)
formatter As BinaryFormatter
formatter= New BinaryFormatter
formatter.serialization(SF, A)
SF.Close
End Sub


The code doesn't execute. I have tested various options
and it seems that the button property of MyCustomClass (or
any Button Class for that matter) won't take to
serialization.

Is there any way around this??

.
 
Back
Top