NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

BindingManager.Item (Object, String)

Gets the ListManager associated with the specified data source and data member.

[C#] In C#, this member is the indexer for the BindingManager class.

[Visual Basic]
Overloads Public Default ReadOnly Property Item( _
   ByVal dataSource As Object, _
   ByVal dataMember As String _
) As ListManager
[C#]
public ListManager this[
   object dataSource,
   string dataMember
] {get;}
[C++]
public: __property ListManager* get_Item(
   Object* dataSource,
   String* dataMember
);
[JScript]
returnValue = BindingManagerObject.Item(dataSource, dataMember);
-or-
returnValue = BindingManagerObject(dataSource, dataMember);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed Item property whose type is Object and whose index type is String.

Arguments [JScript]

dataSource
The data source, typed as Object. Possible data sources include: DataSet, DataTable, DataView, DataSetView, arrays, collections, and any object that implements the IList interface.
dataMember
[To be supplied.]

Parameters [Visual Basic, C#, C++]

dataSource
The data source, typed as Object. Possible data sources include: DataSet, DataTable, DataView, DataSetView, arrays, collections, and any object that implements the IList interface.
dataMember
[To be supplied.]

Property Value

ListManager for the specified data source and data member.

Remarks

See the ListBinding class for a list of possible data sources.

The dataMember argument is required when the is more than one table contained by the data source. For example, a DataSet or a DataSetView can contain multiple DataTable objects.

Example [Visual Basic]

The example below first creates a binding between a data source and a control. The BindingManager is then used to return the ListManager for the control given the same data source and a data member of a System.WinForms.DataSet.

[Visual Basic]

' The following lines go into the Declarations section of the form.
Private lmOrders As ListManager
Private lmProducts As ListManager
Private dsOrders As DataSet
Private dsProducts As DataSet

' Not shown: code to create and populate DataSets with tables.
' The code assumes the dsOrders has two tables, Orders and OrderDetails,
' and dsProducts has two tables Suppliers and Products.

Private Sub BindControls()
   ' Bind four controls to two data sources: 
   ' two DataGrid controls and two ComboBoxes.

   Combo1.Bindings.Add("Text", dsProducts.Tables("Suppliers"), "CompanyName")
   DataGrid1.DataSource = dsProducts
   DataGrid1.DataMember = "Products"

   Combo2.Bindings.Add("Text", dsOrders.Tables("Orders"), "Customer")
   DataGrid2.DataSource = dsOrders
   DataGrid2.DataMember = "OrderDetails"
End Sub

Private Sub GetListManagers()
   ' Get the ListManager objects for each data source.
   lmOrders = me.BindingManager(dsOrders, "Orders")
   lmProducts = me.BindingManager(dsProducts, "Products")
End Sub


Private Sub GetListManager()
   ' Set the ListManager for the bound control using the BindingManager
   ' of the Win Form. Pass the same table to the BindingManager as the bound control.
   myListManager = Me.BindingManager(ds.Tables("Suppliers"))
End Sub

See Also

BindingManager Class | BindingManager Members | System.WinForms Namespace | BindingManager.Item Overload List | BindingsCollection | ListBinding