MTInsert Method (MTNVS collection)



Inserts an orphan MTNV object into this MTNVS collection.



object.MTInsert ToInsert


The Rename method syntax has these parts:




An object expression that evaluates to an MTNVS interface.


An object expression that evaluates to an orphan MTNV object.



MTNV objects can have only one parent. For safety's sake, this method will not silently remove a MTNV from its previous parent. Therefore the object to be inserted must be an orphan; that is, it must already have been removed or detached from its parent.

If the object to insert has a name that already exists in the collection, it is an error. This is unlike the MTCopy and MTMerge methods, which can optionally replace the values of duplicate items. However, in strategies that use MTDetach and MTInsert, it is generally the case that the MTNV object's identity is important; that is, a pointer to the object has been cached somewhere. Thus it is important truly to insert the object into its new collection, and not simply to copy its value.

Name matching takes the collection's MTStyle property into account. This specifies case and locale sensitivity, and whether leading and trailing blanks are trimmed.


Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:




The collection cannot be modified because it is frozen; that is, its MTReadOnly property is true.


The MTParent property of the object to insert is not Nothing.


The collection already contains an item whose MTName property matches the name of the object to insert.

Enabling Operational Intelligence