Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default a serialization problem

Hi, in my excel com addin, am creating instances of buttons and their event
listeners on the excel sheet. Now in order to persist their operations even
after the instance of execution, am saving the sheet and trying to serialize
the list of 'ResultUi' objects that are maintained in an ArrayList(Arr_List).

here's the code am following:

Stream s = File.Open("c:\\New Folder\\empp.txt",
FileMode.Create, FileAccess.ReadWrite);
BinaryFormatter b = new BinaryFormatter();
ResultUi[] rj = new ResultUi[Arr_list.Count];
for (int i = 0; i < Arr_list.Count; i++)
{
rj[i] = (ResultUi)A[i];
b.Serialize(s, rj[i]);
}
s.Close();

This is giving me an exception! that says

'[System.Runtime.Serialization.SerializationExceptio n] = {"Type
'System.__ComObject' in Assembly 'mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable."}

I did mark the 'ResultUi' class [Serializable] but still why am I getting
this exception? Am I missing some thing?

A similar code, I came across on the net, is very much working fine:


emp[] e = {
new emp(1,"Mark",5000),
new emp(2,"Mich",6000),
new emp ( 3, "Amol", 4460 ),
new emp ( 4, "Anil", 9456 ),
new emp ( 5, "Srikanth", 9500 ),
};


Stream s = File.Open("c:\\New Folder\\emp.txt", FileMode.Create,
FileAccess.ReadWrite);
BinaryFormatter b = new BinaryFormatter();
b.Serialize(s, e);
s.Close();

any help in this regard is highly thankful.

Thanks in advance.

Regards,
na_ab
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Serialization and print Adrian Paul[_2_] Excel Programming 1 October 23rd 07 10:05 PM
Serialization of pivot table Keren Excel Programming 0 August 1st 06 08:42 AM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM
Worksheet Serialization - Is It Possible? Alejandro Calbazana Excel Programming 1 January 28th 04 05:37 PM


All times are GMT +1. The time now is 02:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"