Back to Devexpress

WorksheetDataBindingCollection.BindToDataSource(Object, CellRange, ExternalDataSourceOptions) Method

officefileapi-devexpress-dot-spreadsheet-dot-worksheetdatabindingcollection-dot-bindtodatasource-x28-system-dot-object-devexpress-dot-spreadsheet-dot-cellrange-devexpress-dot-spreadsheet-dot-externaldatasourceoptions-x29.md

latest5.1 KB
Original Source

WorksheetDataBindingCollection.BindToDataSource(Object, CellRange, ExternalDataSourceOptions) Method

Binds the worksheet cell range to the specified data source using the specified options.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
WorksheetDataBinding BindToDataSource(
    object dataSource,
    CellRange range,
    ExternalDataSourceOptions options
)
vb
Function BindToDataSource(
    dataSource As Object,
    range As CellRange,
    options As ExternalDataSourceOptions
) As WorksheetDataBinding

Parameters

NameTypeDescription
dataSourceObject

A data source object whose data should be retrieved into the worksheet.

| | range | CellRange |

A CellRange object specifying the cell range in which the retrieved data will be inserted.

| | options | ExternalDataSourceOptions |

An ExternalDataSourceOptions object that contains options used to establish binding.

|

Returns

TypeDescription
WorksheetDataBinding

A WorksheetDataBinding object that contains information about the data-bound range.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the BindToDataSource(Object, CellRange, ExternalDataSourceOptions) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/CS/DataBindingToListExample/Form1.cs#L54

csharp
// Bind the data source to the worksheet range.
WorksheetDataBinding sheetDataBinding = sheet.DataBindings.BindToDataSource(weatherDatasource, bindingRange, dsOptions);

spreadsheet-document-api-data-binding/CS/SpreadsheetApiDataBinding/Program.cs#L53

csharp
// Bind the data source to the worksheet range.
WorksheetDataBinding sheetDataBinding = worksheet.DataBindings.BindToDataSource(weatherDatasource, bindingRange, dsOptions);

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/VB/DataBindingToListExample/Form1.vb#L57

vb
' Bind the data source to the worksheet range.
Dim sheetDataBinding As WorksheetDataBinding = sheet.DataBindings.BindToDataSource(weatherDatasource, bindingRange, dsOptions)

spreadsheet-document-api-data-binding/VB/SpreadsheetApiDataBinding/Program.vb#L47

vb
' Bind the data source to the worksheet range.
Dim sheetDataBinding As WorksheetDataBinding = worksheet.DataBindings.BindToDataSource(weatherDatasource, bindingRange, dsOptions)

See Also

Data Binding in WinForms Spreadsheet Control

DataBindings

Error

WorksheetDataBindingCollection Interface

WorksheetDataBindingCollection Members

DevExpress.Spreadsheet Namespace