|
|
|
Forum Guru
      
Group: Forum Members
Last Login: 2011-08-30 12:38:11
Posts: 61,
Visits: 183
|
|
Hi, In eco I have a IObjectList filled programatically, and I need to put this list in a Reference Handle in order to display it.
How do I have to cast the IObjectList to a compatible argument for brhVersionList.SetElement(
I Tried this but no way I get an error
DialogExportForm.brhVersionList.SetElement(lVmVersionList.AsObject);
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230,
Visits: 1 382
|
|
You dont have to cast it at all
IObjectList lVmVersionList = ... some code here ...;
DialogExportForm.brhVersionList.SetElement(lVmVersionList);
The above should compile and do what you want. IObjectList inherits from IElement and that is the type of the parameter to ReferenceHandle.SetElement().
/Jonas Hogstrom [CapableObjects]
|
|
|
|
|
Forum Guru
      
Group: Forum Members
Last Login: 2011-08-30 12:38:11
Posts: 61,
Visits: 183
|
|
If I doc this I get this Error
ex = {"Attempt to set handle to type Collection(ECOModelRoot) when static type is Collection(VmVersion)"}
I put static type as Collection(VmVersion)
Any Idea?
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230,
Visits: 1 382
|
|
How did you create the objectlist in the first place? if you use IVariablefactoryService.CreateUntypedObjectlist you will get a list with the internal UML-type "Collection(EcoModelRoot)". You will need to use another method of the factory:
CreateTypedObjectList(typeof(VmVersion), false);
That should give you a list that only accepts objects of type VmVersion.
/Jonas Hogstrom [CapableObjects]
|
|
|
|