How Do I Persist Windows Controls To Disk?

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??
 
B

bj

-----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??

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top