ComponentOne DataObjects for .NET
Using C1DataTableSource and Bound Controls
DataObjects for .NET (Enterprise Edition) > Virtual Mode – Dealing with Large Datasets > Using C1DataTableSource and Bound Controls

In order to access a virtual table view data, both programmatically and via data binding, you need to use a C1DataTableSource. This component serves two goals:

AND

A C1DataTableSource is attached to a data set by setting its DataSet property and to a table view in that data set by setting its TableView property. Thus attached to a table view, a C1DataTableSource can be used as a DataSource for bound controls.

If you use another data source for your bound controls (if you bind them directly to the C1DataSet or to a C1DataView), then virtual mode will not work properly, DataObjects for .NET will not fetch segments on row repositioning, so the only data available will be the first fetched segment. Binding your controls to a C1DataTableSource attached to a virtual table view enables virtual mode in the bound controls.

C1DataTableSource also provides methods and properties for programmatic access to a virtual table view allowing navigation of the entire virtual rowset:

Member Description
MoveFirst Positions to the first row.
MoveLast Positions to the first row.
MoveNext Positions to the next row after current.
MovePrevious Positions to the previous row before current.
Seek Positions to a row specified by its primary key value.
CurrentRow Returns the current row C1DataRow object.

You can bind any data-aware GUI controls to a C1DataTableSource, but there is one important consideration: In multi-record data-bound controls, such as grids, special functionality is required to make the scrollbar behave correctly in virtual mode. The True DBGrid for .NET control included in ComponentOne Studio Enterprise includes this functionality and fully supports DataObjects for .NET virtual mode. Therefore, if you need a grid control in virtual mode, we strongly recommend using the True DBGrid for .NET control. You do not need to purchase it separately, since it is provided together with DataObjects for .NET in ComponentOne Studio Enterprise.

Other grid controls, such as the standard Microsoft DataGrid control, work with DataObjects for .NET virtual mode too, but with one restriction: if you go to the end of the rowset using the scrollbar, the grid will show the end of the current segment, not the real end of the virtual rowset. Other than that, DataObjects for .NET virtual mode works with any bound controls without restrictions. For instance, if you position to the last row of the segment (or close to the last row), DataObjects for .NET will fetch more rows and the grid will show them. So, if this peculiarity in scrollbar behavior does not concern you, you can use the standard DataGrid and third-party grid controls with DataObjects for .NET virtual mode.