Serializaton Problem

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hello,

I have a class which inherits from Component. I want to put this component
on a usercontrol. but i get the following error message:

The Type System.ComponentModel.Component isn't marked as serializable.

do i have to implement the ISerialization-interface?
 
Hi Martin,

Placing a Component 'on a UserControl', in the standard sense of the phrase,
doesn't require serialization. In VS.NET you can drag your Component from
the Toolbox onto the UserControl designer and the Component will be added to
the designer's Component tray. In code, you attach the component through
the Components collection of the UserControl, if it was created by VS.NET,
or otherwise just call dispose on the Component yourself. There is no need
to actually attach a Component to a UserControl.

If this error is specific to your code, posting some of the code might be
more helpful to the newsgroup.

ISerialization doesn't exist in the framework, however ISerializable does.
Component derives from MarshalByRefObject so implementing ISerializable on a
Component is not a good design anyway.

HTH
 
Back
Top