It is damn frustrating to use the code below to get to the label name of a specific Universe object. It just loops over and over again looking for a specific object id in a specific class. The object id is unique across all classes. So, the class part is redundant. There is inexplicably no function to obtain the object by giving the unique id. So, we loop and hope the desired object id is near the top.
Set oDesignerClass = m_oUniverse.Classes.FindClass(sClassName)
For nIndex = 1 To oDesignerClass.Objects.Count
Set oDesignerObject = oDesignerClass.Objects(nIndex)
If oDesignerObject.id = nBIObjectID Then
sLabel = m_oUniverse.Classes.FindClass(sClassName).Objects.Item(nIndex).Name
Exit For
End If
Next
When we know everything about the object that we want and could just get it with one line of code that doesn’t need to execute uselessly and repeatedly.
m_oUniverse.Classes.FindClass(sClassName).Objects.(Name).Name = sLabel
Or better yet, by ObjectID (SHOCK!!! I know)
m_oUniverse.(nBIObjectID).Name = sLabel
If someone knows who the idiots are that thought this was a good idea let me know their address. I would have no problems sending the team a book from Amazon on the binary search algorithm were learned in Computer Science 101.