ControlBindingsCollection.Remove Method (Binding)

 

Deletes the specified Binding from the collection.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public void Remove(
	Binding binding
)

Parameters

binding
Type: System.Windows.Forms.Binding

The Binding to remove.

Exception Condition
NullReferenceException

The binding is null.

The following code example removes a specific Binding from a TextBox control's ControlBindingsCollection. The example gets the required Binding by using the Item property, and removes the Binding with the Remove method.

private void RemoveBackColorBinding()
{
   Binding colorBinding = textBox1.DataBindings["BackColor"];
   textBox1.DataBindings.Remove(colorBinding);
}

.NET Framework
Available since 1.1
Return to top
Show: