VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > DataSource Property |
Returns or sets the data source.
[form!]VSFlexGrid.DataSource[ = DataSource ]
This property behaves differently in the ADO and DAO versions of the VSFlexGrid control.
OLEDB/ADO version (VSFLEX8.OCX)
The DataSource parameter is a reference to an object that qualifies as a data source, including ADO Recordset objects and classes or user controls defined as data sources.
You may set the DataSource property at design time using the property window. When you select the DataSource property, you will get a drop-down list enumerating the sources available. These include sources defined with Visual Basic's Data Environment as well as any controls defined as data sources, such as the Microsoft ADO data control.
You may also set the DataSource property at runtime using the Visual Basic Set statement, as shown below:
' ADODC1 is a Microsoft ADO Data control
Set fg.DataSource = ADODC1
DAO version (VSFLEX8D.OCX)
This property can only be set at design time. Use Visual Basic's properties window to set the DataSource property to a Data control already on the form. Once this property is set, the contents of the grid will be updated whenever the associated Data control is refreshed or when the DataRefresh method is called. You cannot set or retrieve this property at run time.
See also the DataMember and DataMode properties.
DataSource