This documentation is archived and is not being maintained.

Binding Constructor (String, Object, String)

Initializes a new instance of the Binding class that simple-binds the indicated control property to the specified data member of the data source.

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

public Binding(
	string propertyName,
	Object dataSource,
	string dataMember


Type: System.String
The name of the control property to bind.
Type: System.Object
An Object that represents the data source.
Type: System.String
The property or list to bind to.


propertyName is neither a valid property of a control nor an empty string ("").


The property given by propertyName does not exist on the control.

You can specify an instance of any of the following classes for the data source:

See the Binding class for more information about creating the dataMember string.

When you create a binding to a control's property, the new Binding inspects the events exposed by the bound control and attaches to two particular events:

If you attempt to bind to a property that does not exist, an ArgumentException will be thrown when the Binding is added to the control's Control.DataBindings collection.

The following code example binds a TextBox control to a table column in a DataSet named myDataSet. The example requires that you have declared myDataSet in the declarations section of the module.

private void CreateDataSet()
   myDataSet = new DataSet("myDataSet");
   /* Populates the DataSet with tables, relations, and 
      constraints. */

private void BindTextBoxToDataSet()
   /* Binds a TextBox control to a DataColumn named
   CompanyName in the DataTable named Suppliers. */
   ("Text", myDataSet, "Suppliers.CompanyName");

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.