BindingCollection Remove.Method (VB6)

Named Arguments

Yes

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.

Programming Tips and 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
						
						

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.