Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LoadFromFile Problem (Read 2110 times)
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
LoadFromFile Problem
Oct 21st, 2009 at 3:21pm
Print Post  
Hi,

i have tried to load a diagram from file - and i get the following LoadFromFileException:

"Cannot create an object of type SVGResistance. Make sure the class provides a constructor with the appropriate prototype."

I Registered the class with the following code in at the from load event

Diagram.RegisterItemClass(GetType(SVGNode_Resistance), "SVGResistance", 1)

Whats wrong with my SVGNode_Resistance class?

greeze Marco
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LoadFromFile Problem
Reply #1 - Oct 21st, 2009 at 3:32pm
Print Post  
You should add to SVGResistance either a constructor without arguments or one that takes a single Diagram argument. Otherwise the control won't know how to instantiate items from your class (e.g. what arguments it should pass to the constructor) when loading a file.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: LoadFromFile Problem
Reply #2 - Oct 21st, 2009 at 3:43pm
Print Post  
Hi Stoyo,  Grin

now, if i load the diagram file, i get a TargetInvocationException ???

  
Back to top
 
IP Logged
 
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: LoadFromFile Problem
Reply #3 - Oct 21st, 2009 at 4:03pm
Print Post  
... i got it, thanks Stoyo!
  
Back to top
 
IP Logged
 
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: LoadFromFile Problem
Reply #4 - Oct 21st, 2009 at 4:29pm
Print Post  
Another Question,

how could i save/load a DiagrmNodeCollection as a property in my ResistanceSVG class?

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LoadFromFile Problem
Reply #5 - Oct 22nd, 2009 at 5:52am
Print Post  
Try calling ctx.SaveObject(collection) and collection = (NodeCollection)ctx.LoadObject() from your save/load method overrides.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint