universe SDK navigating class objects

All,

I need your help to see what i am missing here. I am doing some development work with Universe SDK. When trying to get objects in a class i run into this error consistently.

Here is some snippet from code

Designer.Classes classcoll;
Designer.Class cl;
Designer.object ob;

cl = classcoll.get_FindClass(“ABC”);

This works fine so far.

However i need to parse through the objects in the class and get their names in string format.

so i do
long cnt = cl.Objects.Count;
Console.WriteLine(" The number of objects in class is " +cnt);

//gives me the number of objects in the class.

when i try to loop through these objects

for ( i = 1; i<= cnt; i++)
{
ob = cl.Objects.get_Item(i);
Console.WriteLine(ob.Name);
}

This is where i consistently get this error as shown below.

Any ideas or hints would be greatly appreciated.

The class and the objects do exist.

Console Output :
##############################################

The number of objects in class is 137
System.Runtime.InteropServices.COMException (0x80004005): no Object found!
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFla
gs flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Designer.IObjects.get_Item(Object Index)
at UniverseUpdate.Class1.Main(String[] args)
###############################################


ramaks (BOB member since 2009-03-31)

I think what you want to do is this

ob = cl.Objects.Item(i);


jwhite9 :us: (BOB member since 2006-07-28)

The sdk doesn’t allow ob = cl.Objects.Item(i) the only exposed method is get_Item

I have managed to navigate this through

foreach (Designer.Object ob in cl.Objects)

However it will be nice if there is a way to pick out individual object based on it’s name.


ramaks (BOB member since 2009-03-31)