ListObject::SetDataBinding Method (Object^, String^)

 

Binds a ListObject control to a specified data member of a data source.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

void SetDataBinding(
	Object^ dataSource,
	String^ dataMember
)

Parameters

dataSource
Type: System::Object^

The object to use as a data source for the ListObject control.

dataMember
Type: System::String^

The DataMember that specifies the property to bind to within the object returned by the DataSource.

Exception Condition
SetDataBindingFailedException

Could not bind to the specified data source.

ArgumentException

One or more of the arguments are invalid.

ArgumentNullException

The dataSource argument is null.

The data source can be any object that implements IList, IListSource, IBindingList, or IEnumerable.

The data member must be a property of the data source that returns a bindable collection. For example, a DataSet source has tables as data members.

The following code example creates a DataSet, a DataTable, and a ListObject. It then binds the list object to the DataSet and the DataTable.

This example is for a document-level customization.

No code example is currently available or this language may not be supported.
Return to top
Show: