In order to bind the grid to a data source, the DataSource and optionally the DataMember properties must be set or the SetDataBinding method called. If another control is bound to the same data source as the grid, then both the DataSource and DataMember properties must be set in order for the other control to be synchronized with the grid.
The following table provides a listing of the supported data sources:
DataSource
Description
DataTable
Represents one table of in-memory data.
DataView
Represents a databindable, customized view of a DataTable for sortind, filtering, searching, editing, and navigation.
DataSet
Represents an in-memory cache of data.
DataViewManager
Contains a default DataViewSettingCollection for each DataTable in a DataSet.
Any component that implements the IListSource interface
Provides functionality to an object to return a list that can be bound to a data source.
Any component that implements the IList interface
Represents a collection of objects that can be individually accessed by index.
Jagged arrays
An array whose elements are arrays.
Demonstrations
The following example demonstrates how to bind the grid to a dataset filled by an ADO data adapter:
VB.NET
Copy Code
Imports Xceed.Grid Imports System.Data.OleDb
Dim connectionString As String = "" 'connection query Dim connection As New OleDbConnection( connectionString )
connection.Open()
Dim selectQuery As String = "SELECT * FROM Clients" Dim dataAdapter As New OleDbDataAdapter( selectQuery, connection ) Dim dataSet As New DataSet( "Clients" )
If rows are addedor removed from the jagged array from outside of the grid, then the jagged array must be reassigned to the DataSource property in order for the modifications to be reflected in the grid.
If an existing value is changed in the jagged array from outside of the grid, for example the text of one of the elements, in order for the changes to be reflected in the grid, the jagged array can be reassigned to the grid OR the grid's UpdateRectangles method can be called.