The binding source object that is the source for databinding. This is an object of some sort and can be either a real object or a DataRow/DataTable/DataSet. If a DataTable is used the first row is assumed. If a DataSet is used the first table and first row are assumed.

The object reference is always Page relative, so binding doesn't work against local variables, only against properties of the form. Form properties that are bound should be marked public or protected, but not private as Reflection is used to get the values.

This or me is implicit, but can be specified so "Customer" or "this.Customer" is equivalent.

public string BindingSource { get; set; }


// Bind a DataRow Item
bi.BindingSource = "Customer.DataRow";
bi.BindingSourceMember = "LastName";

// Bind a DataRow within a DataSet  - not recommended though
bi.BindingSource = "this.Customer.Tables["TCustomers"].Rows[0]";
bi.BindingSourceMember = "LastName";

// Bind an Object
bi.BindingSource = "InventoryItem.Entity";
bi.BindingSourceMember = "ItemPrice";

// Bind a form property
bi.BindingSource = "this";   // also "me"
bi.BindingSourceMember = "CustomerPk";

See also:

Class DataBindingItem

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic