473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How Do I Persist Windows Controls To Disk?

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

Nov 20 '05 #1
1 1051
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 asproperties.

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 toan 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 (orany Button Class for that matter) won't take to
serialization.

Is there any way around this??

.

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alberto | last post by:
Could you tell me what it's for the "Persist Security Info ..." value in a connection string. Thank you.
2
by: BH | last post by:
I developed a small web app using the FormsAuthentication class to set a cookie (FormsAuthentication.SetAuthCookie(value, isPersist)). The cookie persists fine on my local PC when "isPersist" is...
3
by: Nhat Yen | last post by:
Hi everyone, I don't know why all the controls of the Table class (server control) has to be reconstructed for each page load. The MSDN said that it is because the children controls are not the...
1
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
4
by: Jon | last post by:
Hello all, I'm in need of some brainstormin help! We have an object that we use in a number of places, both by User Controls and Pages. This object is loaded everytime we need to use the piece...
0
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design...
0
NeoPa
by: NeoPa | last post by:
Introduction: We get fairly frequent questions on here about why settings (including both values AND formatting) of unbound controls on a form, are not stored for reference later, but instead, each...
8
by: siva211662 | last post by:
I want to save windows form and controls (text box,button,user control.. ) along with there properties to hard disk or Database at run time.I tried using with serialization but i am facing some...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.