ComponentOne FlexGrid for WinForms
In This Topic
    Data Binding
    In This Topic

    Data binding is a process that allows one or more data consumers to be connected to a data provider in a synchronized manner. If you move the cursor on a data-bound grid, other controls connected to the same data source will change to reflect the new current record. If you edit a value on a data-bound grid, other controls connected to the same data source will change to reflect the new value.

    C1FlexGrid supports data binding to ADO.NET data source objects such as DataTable, DataView, DataSet, and DataViewManager.

    C1FlexGrid also supports data binding to DataObjects for WinForms components such as C1ExpressTable, C1ExpressView, C1ExpressConnection, C1DataView, C1DataTableSource and C1DataSet.

    To bind the grid to a data source, assign the data source object to the grid's DataSource property. If the data source object contains more than one table, you must also set the DataMember property a string that specifies which table should be used.

    Alternatively, you can assign both properties simultaneously with a single call to the SetDataBinding method.

    When you assign a new data source to the grid, it will automatically refresh its columns to bind to the columns available in the data source. You can then customize the columns by moving, hiding, or deleting them. You can also set column properties such as their Width, EditMask and Format.

    For an example of reordering the grid columns after binding to a data source, see the ColumnOrder sample on GrapeCity website.

    For details about creating ADO.NET data source objects, please refer to the .NET Framework documentation.

    For details about using DataObjects for WinForms, see the DataObjects for WinForms documentation included in ComponentOne Studio Enterprise and ComponentOne Studio WinForms Edition.

    See Also