|
-
Apr 4th, 2003, 02:54 PM
#1
Thread Starter
Fanatic Member
Serialization of a Custom Control
I am trying to persist a treeview in an xml file. I have read a bit about serialization, and think that this is the way to go.
So I have coded in a form that contains the treeview the following:
Dim serialize As XmlSerializer
serialize = NewXmlSerializer(GetType(CustomTreeViews.clsModifiableTreeView))
serialize.Serialize(Console.Out, Me.TreeView1())
Console.Out.WriteLine()
In this code I am simply trying to generate the XML to the console - then I will tackle saving it in an XML file later. I am getting an Invalid Operation Exception error on the second line "There was an error reflecting
'CustomTreeViews.clsModifiableTreeView'." It also states that you cannot perform the operation on an Interface.
How can I serialize my treeview? I thought you could serialize any object?
Thanks in advance.
-
Apr 6th, 2003, 03:58 AM
#2
Actually not all objects are serializable. Only ones that have the Serializable attribute applied or that implement the ISerializable interface.
-
Apr 23rd, 2003, 05:41 PM
#3
New Member
Serialize Chart Space???!!!
Hi All,
Question specially for Ednees
I was wondering if sombody knows how to serialize a chart space?
At the moment may app pass the line where I am trying to serilize my chart, it sends me an error messange telling me that the AXOWC10 "some other stuff" does not allow serialization.
I know not all objects can be serialized, BUT, if chart space can not be serialized... How is it saved in Excel and other aplications???
I have been reading about Serializing Active X controls at:
http://msdn.microsoft.com/library/de...erializing.asp
but still is not clear to me...
Thanks in advance for you shared knowledge...!!!
-
Apr 23rd, 2003, 06:37 PM
#4
That article is for C++ which I don't think you are using. Serialization is something new to .NET. Well at least the common ways we do it in .NET before you had to use custom techniques to serialize objects which mean persisting all the properties in a loop using something like a propertybag. So I don't think you can serialize activeX objects unless you write your own method since they weren't made to work with the .NET serialization way. Charts and outside objects can be added and saved in Excel via OLE automation. What is it you are trying to do?
-
Apr 23rd, 2003, 06:55 PM
#5
New Member
Save Charts
Edneeis,
I have an APP where you can create charts for analysis.
Then you should be able to save these charts in order to retrive them later with the settings and filters that you aplied to them when you first created those charts.
The idea is that once you invested time seting up the chart (Data source, Series, categories, filters, etc) you dont have to do it every time ...
I think serialization should be the way to go, but any other way to SAVE is ok... I just need to SAVE the object or its properties in order to save time and work.
Can you help me?
Regards.
-
Apr 23rd, 2003, 07:39 PM
#6
And what are the chart objects? Is it a .NEt component? An activeX Control? ActiveX Object? Part of Excel?
-
Apr 24th, 2003, 12:55 AM
#7
New Member
Chart Space
The chart space is the one that comes with the offcie web components Xp
-
Apr 24th, 2003, 04:31 AM
#8
Lively Member
FAO: VBCrazyCoder
A Good book on XML for .NET is
'Applied XML Programming for Microsoft .NET' by Dino Esposito published by Microsoft Press.
In Chapter 11 on XML Serialization he states as a cautionary note:
If the class being serialized does not provide the default constructor, an exception is thrown and the class won't be processed further. The XML Serializer class raises an InvalidOperationException stating that the class can't be successfully reflected.
Basically the serializer needs to create an instance of the class to be able to get all it's info for serialization. If no default constructor is available then it can't be instantiated and the exception is thrown.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|