Binding Collection Remove Method VB

Named Arguments

Syntax oBindingColl. Remove( Binding) oBindingColl Use: Required

Data Type: BindingCollection object

An object reference that returns a BindingCollection object.

Binding

Use: Required

Data Type: Binding object

A reference to a binding object in the BindingCollection. Description

Removes a previously added Binding object from the BindingCollection object.

138 Chapter 7- The Language Reference

Programming Tips & Gotchas

Unlike most other Remove methods attached to collections in VBA, the Binding-Collection's Remove method's parameter is a reference to the object being removed from the collection.

Example

In this short snippet, we access the Item method using the key assigned to the Binding object we want to remove. The method call assigns a reference to the Binding object to be removed to our local oBind object variable, which can then be passed to the Remove method. We then set the Bind object variable to Nothing afterwards. The For Each...Next statement proves that the object has been removed.

Set oBind = obcAuthors.Item("address")

obcAuthors.Remove oBind Set oBind = Nothing

For Each oBind In obcAuthors

Debug.Print oBind.Key Next

Was this article helpful?

0 0

Post a comment