473,785 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 22114
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 IXmlSerializabl e 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*****@hotmai l.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.I SerializationSu rrogate
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
ISerializationS urrogate 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*****@hotmai l.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
2155
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 : System.Windows.Forms.Control { private System.Windows.Forms.TextBox Calculation;
1
3267
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 System.Windows.Forms.Control class as the control is being created? i.e. does ControlAdded() get fired before Paint()? I good overview event document would work great. Thanks in advance.
2
1633
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 Windows.Form.Control class. I have put it on a web form with the following code : <OBJECT id="MyWebControl" height="300" width="300"
1
1451
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 development machine. The problem is that on other machines with the same framework version the control does not render. I set all of the activex security settings in the browser (on the other machines ) to enable signed or unsigned controls. I did...
1
2797
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 from FCL using system.tlb or mscorelib.tlb from dot net framework. I could use ArrayList successfully without any issue.
2
2418
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 assume that the code throws exception when it is trying to retrieve the processes list that has certain name. Below is the code that I use to retrieve the processes. Process processes = Process.GetProcessesByName("xxxx");
6
2834
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 is able to be set in the property window and you can do Label1.BorderStyle = BorderStyle.None in the Form's Code. Can anyone help with this? For Each ctrl As Control In Form.Controls ctrl.BorderStyle = BorderStyle.None Next
2
1995
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 not contain a definition for 'Clear'". Could someone help me with that. This happen for other methods that are used in many places of the sources I am using but when I want to use them it gives me error message. Thanks -- Nejadian
4
25385
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 that are in the GroupBox. I know how to do it in VB.Net but when I try something similar in C# I get the following error: Cannot implicitly convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.ComboBox'. An explicit conversion...
0
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.