473,508 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialize a object inherited Label control

Hi...
i try to serialize a object inherited of label control, as follow:

//definition

public class WinLabel : System.Windows.Forms.Label
{
public WinLabel() {}
}

//execution
WinLabel l = new WinLabel();
l.Text="text";
l.Name="name";

XmlSerializer ser = new XmlSerializer(typeof(MO.WinLabel)); //error
happening this line
FileStream fs = File.OpenWrite("c:\\label.xml");
XmlTextWriter x = new XmlTextWriter(fs,System.Text.Encoding.UTF8);
x.Formatting=Formatting.Indented;
try
{
ser.Serialize(x,l);
}
finally
{
fs.Close();
}

But error happening: "An unhandled exception of type
'System.InvalidOperationException' occurred in system.xml.dll"

thank's for any help..

ps.: sorry my bad english...
--
Cheers,
Rafael
Nov 12 '05 #1
1 3046
"Luiz Rafael Fernandes" <no****@hotmail.com> wrote in message news:ey**************@tk2msftngp13.phx.gbl...
i try to serialize a object inherited of label control, as follow:

public class WinLabel : System.Windows.Forms.Label : : But error happening: "An unhandled exception of type
'System.InvalidOperationException' occurred in system.xml.dll"


Serialization of the interface property you've inherited from Control, Site, is not supported.

It's not necessary to serialize Site at all, so write a custom serializer that skips it.
Derek Harmon
Nov 12 '05 #2

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

Similar topics

5
24663
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
10
4125
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
0
2211
by: Frnak McKenney | last post by:
I'm running into problems with VisualStudio.NET2003 and Windows Forms inheritance. It _feels_ like a bug, but it could just as well be a misunderstanding on my part regarding how the VS Designer...
0
264
by: Luiz Rafael Fernandes | last post by:
Hi... i try to serialize a object inherited of label control, as follow: //definition public class WinLabel : System.Windows.Forms.Label { public WinLabel() {} }
19
2315
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
2
2080
by: Sjaakie Helderhorst | last post by:
Hi there, I created my own user control (myControl) containing: myCaption - docked top myGrid - docked.fill (datasource: myDataset) myPanel - docked bottom This control is added to the form:...
3
1773
by: Jeff User | last post by:
Hello I am using C#, .net1.1 Vis Studio 2003 I am using homeBase.aspx.cs page as a base for several other aspx/aspx.cs web pages. The base page handles some operations that are common to all...
6
492
by: tshad | last post by:
I had asked about this before, but have been unable to solve the problem. Could this be a problem with Web Services? I have 4 web services that I reference in this object. There is only one...
0
1653
by: Mark | last post by:
I want to create a user control inherited from a TextBox with an associated label (let's call it a LabelTextBox). The trick is that I want the control to inherit from TextBox and have all of its...
0
7393
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...
1
7058
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
7502
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...
1
5057
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
4715
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...
0
3206
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...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
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...

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.