The following example uses the Count property to return the number of properties for a given data object. If the number of properties is greater than 2, the procedure loops through the collection, and uses the Remove method to delete properties other than Item Weight and Item Color:
Private Sub DeleteExtraProperties_Click() Dim ItemCollection As DUOSObjects Dim ItemObject As DUOSObject Dim ItemProperties As DUOSProperties Dim ItemProperty As DUOSProperty Set ItemCollection = DUOSObjectsGet("ItemInfo") Set ItemObject = ItemCollection(ItemNumber) Set ItemProperties = ItemObject.Properties If ItemProperties.Count > 2 Then 'There are too many properties for this object 'Remove any other than Item Weight and Item Color For Each ItemProperty In ItemProperties If Not ((ItemProperty.Name = "Item Weight") Or _ (ItemProperty.Name = "Item Color")) Then ItemProperties.Remove (ItemProperty) End If Next End If End Sub