ListObject::DataSource Property

 

Gets or sets the source that contains a list of values that are used to populate the items within the control.

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

property Object^ DataSource {
	Object^ get();
	void set(Object^ value);
}

Property Value

Type: System::Object^

The source that contains a list of values that are used to populate the items within the control. The default value is null.

At run time, use the SetDataBinding method to set the DataSource and DataMember properties.

The following data sources are valid:

See the Binding class overview for more information on data sources.

If the DataSource reference contains more than one table or property, you must set the DataMember property to a string that specifies the table to bind to. For example, if the DataSource is a DataSet or DataViewManager that contains three tables named Customers, Orders, and OrderDetails, you must specify the table to bind to.

Setting the DataSource to an object that does not implement the IList interface or an IListSource will cause an exception to be thrown.

The following code example creates a DataSet with two DataTable objects and populates one of the tables with data. The code then sets the DataSource and DataMember properties of the ListObject to bind to the table that contains data.

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: