Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Serialization problem, "is not marked as serializable" error for UserControl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nirdeshonline@gmail.com - 27 Aug 2007 12:42 GMT
Hi,

I am serializing a custom class holding some data for my project.

This data internally contains a class which contains an event

public delegate void MemberModifiedEventHandler(object sender,
MemberModifiedEventArgs e);

/// <summary>

/// Occurs on modification in a group.

/// </summary>

public event MemberModifiedEventHandler OnMembersModified;

This sender brings in a CutomPage derived from
System.Windows.Forms.UserControl.

I do not need to serialize this class as it contains only UI and has
got nothing to be saved and serialized.

But when i serialize the data it gives the error "CutomPage is not
marked as serializable".

How can i come across this problem without serializing this page.

NonSerializable attribute does not work for events and classes.

How can i serialize my data without serializing these usercontrol
clases.

Waiting for a kind reply.

Thanks & Regards

Nirdesh Dabas

nirdesh_12@yahoo.com
Nicholas Paldino [.NET/C# MVP] - 27 Aug 2007 15:15 GMT
Nirdesh,

   Have you tried applying it to the field on the event, like so?

[field:NonSerializable]
public event EventHandler MyEvent;

   That should work.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi,
>
[quoted text clipped - 36 lines]
>
> nirdesh_12@yahoo.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.