473,425 Members | 1,791 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,425 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 22082
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...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.