officefileapi-devexpress-dot-spreadsheet-dot-worksheetdatabindingcollection-dot-getdatabindings-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md
Obtains data bindings for the cells in the specified range.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
IList<WorksheetDataBinding> GetDataBindings(
CellRange range
)
Function GetDataBindings(
range As CellRange
) As IList(Of WorksheetDataBinding)
| Name | Type | Description |
|---|---|---|
| range | CellRange |
A CellRange of cells in a worksheet.
|
| Type | Description |
|---|---|
| IList<WorksheetDataBinding> |
A IList<T><WorksheetDataBinding,> generic list .
|
To get the data binding for a particular cell, use the WorksheetDataBindingCollection.GetDataBinding method.
Worksheet sheet = spreadsheetControl1.Document.Worksheets.ActiveWorksheet;
var bindings = sheet.DataBindings.GetDataBindings(sheet.Selection);
string s = "No data bindings found";
if (bindings.Count != 0) {
s = "The selected range contains the following data bindings:\r\n";
foreach (WorksheetDataBinding binding in bindings)
s += String.Format("Binding {0}\r\n", binding.Range);
}
MessageBox.Show(s);
Dim sheet As Worksheet = spreadsheetControl1.Document.Worksheets.ActiveWorksheet
Dim bindings = sheet.DataBindings.GetDataBindings(sheet.Selection)
Dim s As String = "No data bindings found"
If bindings.Count <> 0 Then
s = "The selected range contains the following data bindings:" & ControlChars.CrLf
For Each binding As WorksheetDataBinding In bindings
s &= String.Format("Binding {0}" & ControlChars.CrLf, binding.Range)
Next binding
End If
MessageBox.Show(s)
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetDataBindings(CellRange) 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.
Worksheet sheet = spreadsheetControl1.Document.Worksheets.ActiveWorksheet;
var bindings = sheet.DataBindings.GetDataBindings(sheet.Selection);
string message = "No data bindings found";
Dim sheet As Worksheet = spreadsheetControl1.Document.Worksheets.ActiveWorksheet
Dim bindings = sheet.DataBindings.GetDataBindings(sheet.Selection)
Dim message As String = "No data bindings found"
See Also
Data Binding in WinForms Spreadsheet Control
WorksheetDataBindingCollection Interface