473,395 Members | 1,679 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,395 software developers and data experts.

How to serialize a System.Windows.Form.Control

Is there anybody who can help me to serialize a control
like buttons, textbox, and each other control?I don't
want to inherit from some of those.I try with
SoapFormatter but it tell it can't serialize the control
because it doesn't have the [Serialized] attribute. After
I try with a XmlSerializer but it tells that it can't
serialize it.Anyone has some idea?
Nov 15 '05 #1
2 22081
Hi,

You can implement the ISerializable interface and write your own
serialization/deserialization code. This will work for binary serialization.
For the XML one, there's an unsupported IXmlSerializable interface you can
still implement to add custom XML serialization to your control. There's a
good Aaron Skonnard's article on how this is done.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

<to*****@hotmail.com> wrote in message
news:09****************************@phx.gbl...
Is there anybody who can help me to serialize a control
like buttons, textbox, and each other control?I don't
want to inherit from some of those.I try with
SoapFormatter but it tell it can't serialize the control
because it doesn't have the [Serialized] attribute. After
I try with a XmlSerializer but it tells that it can't
serialize it.Anyone has some idea?


Nov 15 '05 #2
In addition to Demitriy's suggestion.

You can define & register a Serialization Surrogate. That is define a class
that implements the System.Runtime.Serialization.ISerializationSurroga te
interface.

A Serialization Surrogate is a helper class that knows how to read the
values of the Control and save them in the serialization stream, it also
knows
how to deserialize the values and create the Control again.

Part 3 of the following 3 part MSDN Magazine articles covers
ISerializationSurrogate along with caveats on its use.

http://msdn.microsoft.com/msdnmag/issues/02/04/net/
http://msdn.microsoft.com/msdnmag/issues/02/07/net/
http://msdn.microsoft.com/msdnmag/issues/02/09/net/

Hope this helps
Jay
<to*****@hotmail.com> wrote in message
news:09****************************@phx.gbl...
Is there anybody who can help me to serialize a control
like buttons, textbox, and each other control?I don't
want to inherit from some of those.I try with
SoapFormatter but it tell it can't serialize the control
because it doesn't have the [Serialized] attribute. After
I try with a XmlSerializer but it tells that it can't
serialize it.Anyone has some idea?

Nov 15 '05 #3

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

Similar topics

0
by: Sinisa | last post by:
I have a Windows form which has multiple groups of the same window controls. I wanted to create a control class that has the standard controls in one. something like: public class Sensor :...
1
by: Jay Douglas | last post by:
Hello, This may be an elementary question, but I'm having a hard time finding a document that answers this question: What order are the events fired on classes / controls inherited from the...
2
by: Softwaremaker | last post by:
Hi all, I have created a Windows Form control that runs on a web form. This control is a composite control comprising of other textboxes (public scope). This control inherits from the...
1
by: Brent Jenny | last post by:
I have created a simple windows form control using C# based on the following article. http://www.devhood.com/tutorials/tutorial_details.aspx?utorial_id=388&printer=t It works fine on my...
1
by: Rajesh Kumar Choudhary | last post by:
Hi, I want to use the system.windows.form.datagrid control present in .net 2005 or 2003. Is it possible to use this? Please let me know if it is not supported. I have seen and used the classes...
2
by: Budhi Saputra Prasetya | last post by:
Hi, I managed to create a Windows Form Control and put it on my ASP .NET page. I have done the suggestion that is provided by modifying the security settings. From the stack trace, I would...
6
by: mgawelek | last post by:
I am doing this in vb.net 2K5 The code below is in a module trying to edit the main form's label control. The error message is: BorderStyle is not a member of System.Windows.Forms.Control. When it...
2
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
Hi, I am using Visual Studio C# windows. Every time I want to use some of the methods in System.Windows.Form such as Clear(), it gives me error message and saying "System.Windows.Forms.TextBox does...
4
by: clflyer | last post by:
I have a small problem. I'm pretty much a newbie to C# coming out of VB.Net. I have a windows form that has a GroupBox named grpSoldTo. I want to be able to clear all the textboxes and comboxes...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.