Export (0) Print
Expand All

BindingContext::Item Property (Object)

Gets the BindingManagerBase that is associated with the specified data source.

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

public:
property BindingManagerBase^ Item[Object^ dataSource] {
	BindingManagerBase^ get (Object^ dataSource);
}

Parameters

dataSource
Type: System::Object

The data source associated with a particular BindingManagerBase.

Property Value

Type: System.Windows.Forms::BindingManagerBase
A BindingManagerBase for the specified data source.

Use this overload if the BindingManagerBase you want does not require a navigation path. For example, if the BindingManagerBase manages a set of Binding objects that use an ArrayList or DataTable as the DataSource, no navigation path is required.

NoteNote

The Item property will always return a BindingManagerBase, and never return nullptr.

See the Binding class for a list of possible data sources and for information about creating bindings between controls and data sources.

The following code example returns three BindingManagerBase objects: one for a DataView, one for an ArrayList, and one for the DataSource of a Binding that belongs to a TextBox control.

   void ReturnBindingManagerBase()
   {

      // Get the BindingManagerBase for a DataView. 
      BindingManagerBase^ bmCustomers = this->BindingContext[ myDataView ];

      /* Get the BindingManagerBase for an ArrayList. */
      BindingManagerBase^ bmOrders = this->BindingContext[ myArrayList ];

      // Get the BindingManagerBase for a TextBox control.
      BindingManagerBase^ baseArray = this->BindingContext[ textBox1->DataBindings[ nullptr ]->DataSource ];
   }

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft